QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#673955 | #6110. Squirrel Game | stompQ | WA | 1ms | 3836kb | C++23 | 1.1kb | 2024-10-25 12:19:20 | 2024-10-25 12:19:21 |
Judging History
answer
#include <iostream>
#include <deque>
using namespace std;
int a[100005];
long long int trya(deque<long long int> v) {
while (!v.empty() && v.front() == 0) v.pop_front();
if (v.empty()) return 0;
if (v.size() == 1) return v[0];
if (v.size() == 2) return v[1];
deque<long long int> vv, va, vb;
vv.push_back(v[0]);
for (int i = 1; i < v.size(); i++) {
vv.push_back(v[i] + v[i - 1]);
}
vv.push_back(v.back());
for (int i = 0; i < vv.size(); i++) {
if (i & 1) vb.push_back(vv[i]);
else va.push_back(vv[i]);
}
return (trya(va) ^ trya(vb));
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int m, n, k;
cin >> m >> n >> k;
for (int i = 1; i <= n; i++) {
cin >> a[i];
}
for (int i = n; i >= 1; i--) {
a[i] = a[i] - a[i - 1] - 1;
}
long long int res = 0;
for (int i = 1; i <= k; i++) {
deque<long long int> v;
for (int j = i; j <= n; j += k) {
v.push_back(a[j]);
}
res ^= trya(v);
}
if (res == 0) cout << "Nova";
else cout << "Twinkle";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3628kb
input:
7 3 2 1 4 7
output:
Nova
result:
ok single line: 'Nova'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
7 3 1 1 4 7
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 1 1 1
output:
Nova
result:
ok single line: 'Nova'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
1 1 10 1
output:
Nova
result:
ok single line: 'Nova'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
100000 1 1 19593
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
100000 1 10 62516
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
100 10 1 23 24 43 47 62 66 68 73 82 85
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
100 10 3 11 18 23 26 30 40 52 76 78 99
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
100 10 7 14 27 51 62 66 71 75 79 80 97
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
100 10 10 10 18 25 50 51 54 64 77 95 96
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3484kb
input:
100 5 10 15 52 61 65 78
output:
Twinkle
result:
ok single line: 'Twinkle'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
10 10 1 1 2 3 4 5 6 7 8 9 10
output:
Nova
result:
ok single line: 'Nova'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
10 10 3 1 2 3 4 5 6 7 8 9 10
output:
Nova
result:
ok single line: 'Nova'
Test #14:
score: -100
Wrong Answer
time: 0ms
memory: 3608kb
input:
100 10 1 5 16 25 28 39 49 58 63 79 85
output:
Twinkle
result:
wrong answer 1st lines differ - expected: 'Nova', found: 'Twinkle'