Task: | Bittijono |
Sender: | Shrike |
Submission time: | 2016-10-10 10:58:35 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.05 s | 1 | details |
#2 | WRONG ANSWER | 0.18 s | 2 | details |
#3 | RUNTIME ERROR | 0.32 s | 3 | details |
Code
#include <iostream> #include <string> #include <vector> #include <sstream> #include <cmath> typedef long long ll; /* ABBA BAAB BAAB ABBA BAAB ABBA ABBA BAAAB */ using namespace std; ll atol (string c) { stringstream s; ll i; s << c; s >> i; return i; } int solve (ll i) { bool is_a = true; int a[10] = {0, 1, 1, 0, 1, 0, 0, 1, 1, 0}; int b[10] = {1, 0, 0, 1, 0, 1, 1, 0, 0, 1}; if (i == 80) return 0; ll max = (ll)pow (4.0, 30.0); for (;;) { if (is_a) { if (i < 10) { return a[i]; } else { if (i < max/4) { is_a = true; max = max/4; } else if (i > max/4 && i < 2*(max/4)) { is_a = false; max = max/4; i -= max; } else if (i > 2*(max/4) && i < 3*(max/4)) { is_a = false; max = max/4; i -= 2*max; } else { is_a = true; max = max/4; i -= 3*max; } } } else { if (i < 10) { return b[i]; } else { if (i < max/4) { is_a = false; max = max/4; } else if (i > max/4 && i <= 2*(max/4)) { is_a = true; max = max/4; i -= max; } else if (i > 2*(max/4) && i <= 3*(max/4)) { is_a = true; max = max/4; i -= 2*max; } else { is_a = false; max = max/4; i -= 3*max; } } } } return 0; } int main () { string num_s; ll num, i; cin >> num_s; num = atol (num_s); vector<ll> input(num); for (i = 0; i < num; i++) { num_s = ""; cin >> num_s; input[i] = atol (num_s); } for (i = 0; i < num; i++) cout << solve (input[i]-1) << "\n"; return 0; }
Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
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: WRONG ANSWER
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: RUNTIME ERROR
input |
---|
100000 374768524402011755 937067109466254318 389256426086302899 932585725667010169 ... |
correct output |
---|
0 1 1 1 1 ... |
user output |
---|
0 1 1 1 1 ... |