Submission #2999557
Source Code Expand
#include "bits/stdc++.h" using namespace std; typedef long long ll; const ll MOD = 1000000007LL; ll sum[25]; int main() { ll K, N; cin >> K >> N; if (K % 2 == 0) { cout << K / 2; for (int i = 0; i < N - 1; i++) cout << " " << K; cout << endl; return 0; } int k = 0; sum[0] = 1; ll t = 1; while (1) { t *= K; if (sum[k] + t > N) break; sum[k + 1] = sum[k] + t; k++; } sum[k + 1] = sum[k] + t; k++; int d = (K + 1) / 2; cout << d; int i; int offset = 0; for (i = 1; i < N; i++) { if (N - i - 1 <= k && sum[N - i - 1] / 2 <= offset) break; cout << " " << d; if ((N-i) % 2) offset++; } int idx = (sum[N - i] + 1) / 2 - offset; for (int j = N - i - 1; j >= 0; j--) { if (idx == 0) idx = sum[j]; if (idx == 1) break; idx--; cout << " " << (idx + sum[j] - 1) / sum[j]; idx %= sum[j]; } cout << endl; }
Submission Info
Submission Time | |
---|---|
Task | E - Finite Encyclopedia of Integer Sequences |
User | Div9851 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 890 Byte |
Status | RE |
Exec Time | 100 ms |
Memory | 2304 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 800 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, s1.txt, s2.txt, s3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | RE | 100 ms | 256 KB |
02.txt | AC | 1 ms | 256 KB |
03.txt | AC | 1 ms | 256 KB |
04.txt | AC | 1 ms | 256 KB |
05.txt | AC | 1 ms | 256 KB |
06.txt | RE | 99 ms | 256 KB |
07.txt | AC | 19 ms | 640 KB |
08.txt | AC | 24 ms | 768 KB |
09.txt | AC | 19 ms | 640 KB |
10.txt | AC | 27 ms | 2304 KB |
11.txt | AC | 29 ms | 2304 KB |
12.txt | AC | 8 ms | 640 KB |
13.txt | AC | 13 ms | 1024 KB |
14.txt | AC | 5 ms | 512 KB |
15.txt | AC | 1 ms | 256 KB |
16.txt | AC | 1 ms | 256 KB |
17.txt | AC | 1 ms | 256 KB |
18.txt | AC | 1 ms | 256 KB |
19.txt | AC | 1 ms | 256 KB |
20.txt | AC | 22 ms | 1792 KB |
21.txt | AC | 2 ms | 256 KB |
22.txt | AC | 2 ms | 256 KB |
23.txt | AC | 21 ms | 1664 KB |
24.txt | AC | 10 ms | 768 KB |
25.txt | AC | 25 ms | 768 KB |
26.txt | AC | 8 ms | 384 KB |
27.txt | AC | 11 ms | 512 KB |
28.txt | AC | 10 ms | 512 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |
s3.txt | AC | 1 ms | 256 KB |