Task: | Tickets |
Sender: | intoo |
Submission time: | 2018-07-23 17:04:21 +0300 |
Language: | C++ |
Status: | READY |
Result: | 30 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 30 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.02 s | 1 | details |
#2 | ACCEPTED | 0.01 s | 1 | details |
#3 | ACCEPTED | 0.02 s | 1 | details |
#4 | WRONG ANSWER | 0.01 s | 2 | details |
#5 | WRONG ANSWER | 0.02 s | 2 | details |
#6 | WRONG ANSWER | 0.02 s | 2 | details |
#7 | WRONG ANSWER | 0.03 s | 2 | details |
#8 | WRONG ANSWER | 0.03 s | 2 | details |
#9 | WRONG ANSWER | 0.01 s | 2 | details |
#10 | WRONG ANSWER | 0.01 s | 2 | details |
Code
#include <iostream> #define ll long long using namespace std; bool c[64]; int main() { int n; ll k; cin >> n >> k; k--; bool o = 1; ll t = 0; int i = 0; for (ll b = 1<<(n-1); b >= 1; b /= 2) { if (o) { if (k < b+t) c[i] = 0; else { c[i] = 1; o = 0; t += b; } } else { if (k >= b+t) { c[i] = 0; t += b; } else { c[i] = 1; o = 1; } } i++; } for (int i = 0; i < n; i++) { cout << c[i]; } cout << endl; }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
7 85 |
correct output |
---|
1111110 |
user output |
---|
1111110 |
Test 2
Group: 1
Verdict: ACCEPTED
input |
---|
13 173 |
correct output |
---|
0000011111010 |
user output |
---|
0000011111010 |
Test 3
Group: 1
Verdict: ACCEPTED
input |
---|
19 506935 |
correct output |
---|
1000110001000101101 |
user output |
---|
1000110001000101101 |
Test 4
Group: 2
Verdict: WRONG ANSWER
input |
---|
33 7115188065 |
correct output |
---|
101111100000101011011010011010... |
user output |
---|
100000000000000000000000000000... |
Test 5
Group: 2
Verdict: WRONG ANSWER
input |
---|
38 262459861045 |
correct output |
---|
100011100101100011101001111100... |
user output |
---|
100000000000000000000000000000... |
Test 6
Group: 2
Verdict: WRONG ANSWER
input |
---|
45 26770081139000 |
correct output |
---|
101000111010010010111101110111... |
user output |
---|
100000000000000000000000000000... |
Test 7
Group: 2
Verdict: WRONG ANSWER
input |
---|
49 144198060398585 |
correct output |
---|
011000010101101110110011100111... |
user output |
---|
100000000000000000000000000000... |
Test 8
Group: 2
Verdict: WRONG ANSWER
input |
---|
52 1688586557587460 |
correct output |
---|
011100000000001000111110100100... |
user output |
---|
100000000000000000000000000000... |
Test 9
Group: 2
Verdict: WRONG ANSWER
input |
---|
58 50090466019539205 |
correct output |
---|
001110100100001111100000101100... |
user output |
---|
100000000000000000000000000000... |
Test 10
Group: 2
Verdict: WRONG ANSWER
input |
---|
62 436075923621359553 |
correct output |
---|
000101000010111110000011100011... |
user output |
---|
100000000000000000000000000000... |