Task: | Bittijono |
Sender: | fergusq |
Submission time: | 2016-10-03 21:20:42 +0300 |
Language: | C++ |
Status: | READY |
Result: | 29 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 10 |
#2 | ACCEPTED | 19 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.06 s | 1 | details |
#2 | ACCEPTED | 0.14 s | 2 | details |
#3 | WRONG ANSWER | 0.12 s | 3 | details |
Code
#include <iostream> using namespace std; const int tab32[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31}; int log2_32 (uint32_t value) { value |= value >> 1; value |= value >> 2; value |= value >> 4; value |= value >> 8; value |= value >> 16; return tab32[(uint32_t)(value*0x07C4ACDD) >> 27]; } int solve(int k) { if (k <= 1) return k; return !solve(k-(1<<log2_32(k))); } int main() { int n; cin >> n; for (int i = 0; i < n; i++) { int k; cin >> k; cout << solve(k-1) << endl; } }
Test details
Test 1
Group: 1
Verdict: ACCEPTED
input |
---|
100 62 9 12 73 ... |
correct output |
---|
1 1 1 0 1 ... |
user output |
---|
1 1 1 0 1 ... |
Test 2
Group: 2
Verdict: ACCEPTED
input |
---|
100000 565433 141881 120108 825392 ... |
correct output |
---|
1 1 0 0 1 ... |
user output |
---|
1 1 0 0 1 ... |
Test 3
Group: 3
Verdict: WRONG ANSWER
input |
---|
100000 374768524402011755 937067109466254318 389256426086302899 932585725667010169 ... |
correct output |
---|
0 1 1 1 1 ... |
user output |
---|
0 0 0 0 0 ... |