QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#820366 | #9852. Divisions | tselmegkh# | WA | 1ms | 3720kb | C++14 | 1.3kb | 2024-12-18 21:10:16 | 2024-12-18 21:10:21 |
Judging History
answer
#include<iostream>
using namespace std;
void solve() {
int k;
cin >> k;
if (k == 0) {
cout << "6\n" << "3 1 4 2 5 4\n";
return;
}
if (k == 1) {
cout << "6\n" << "1 1 4 5 1 4\n";
return;
}
for (int i = 1; i <= 30; i++) {
if ((1ll << i) == k) {
cout << i << '\n';
for (int j = 0; j < i; j++) {
cout << 1 << " \n"[j == i - 1];
}
return;
}
if ((1ll << i) + 1 == k) {
cout << i + 1 << '\n';
cout << 1 << ' ';
for (int j = 0; j < i; j++) {
cout << 2 << " \n"[j == i - 1];
}
return;
}
if ((1ll << i) + 2 == k) {
cout << i + 2 << '\n';
cout << 1 << ' ';
for (int j = 0; j < i; j++) {
cout << 2 << " ";
}
cout << 1 << ' ';
return;
}
}
if (k <= 366) {
cout << k - 1 << '\n';
for (int i = 1; i <= k - 1; i++) {
cout << i << " \n"[i == k - 1];
}
return;
}
cout << "-1\n";
}
int main() {
ios::sync_with_stdio(0);cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3648kb
input:
1
output:
6 1 1 4 5 1 4
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
2
output:
1 1
result:
ok correct
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
0
output:
6 3 1 4 2 5 4
result:
ok correct
Test #4:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
3
output:
2 1 2
result:
ok correct
Test #5:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
4
output:
3 1 2 1
result:
ok correct
Test #6:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
5
output:
3 1 2 2
result:
ok correct
Test #7:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
6
output:
4 1 2 2 1
result:
ok correct
Test #8:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
7
output:
6 1 2 3 4 5 6
result:
ok correct
Test #9:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
8
output:
3 1 1 1
result:
ok correct
Test #10:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
9
output:
4 1 2 2 2
result:
ok correct
Test #11:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
10
output:
5 1 2 2 2 1
result:
ok correct
Test #12:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
11
output:
10 1 2 3 4 5 6 7 8 9 10
result:
ok correct
Test #13:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
12
output:
11 1 2 3 4 5 6 7 8 9 10 11
result:
ok correct
Test #14:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
13
output:
12 1 2 3 4 5 6 7 8 9 10 11 12
result:
ok correct
Test #15:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
14
output:
13 1 2 3 4 5 6 7 8 9 10 11 12 13
result:
ok correct
Test #16:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
15
output:
14 1 2 3 4 5 6 7 8 9 10 11 12 13 14
result:
ok correct
Test #17:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
16
output:
4 1 1 1 1
result:
ok correct
Test #18:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
24
output:
23 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
result:
ok correct
Test #19:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
31
output:
30 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
result:
ok correct
Test #20:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
32
output:
5 1 1 1 1 1
result:
ok correct
Test #21:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
63
output:
62 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
result:
ok correct
Test #22:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
64
output:
6 1 1 1 1 1 1
result:
ok correct
Test #23:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
127
output:
126 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #24:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
128
output:
7 1 1 1 1 1 1 1
result:
ok correct
Test #25:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
255
output:
254 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...
result:
ok correct
Test #26:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
256
output:
8 1 1 1 1 1 1 1 1
result:
ok correct
Test #27:
score: -100
Wrong Answer
time: 0ms
memory: 3644kb
input:
511
output:
-1
result:
wrong answer jury has answer but participant not