QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#113872#6642. (1, 2) NimITMO_pengzoo#AC ✓7ms3880kbC++20939b2023-06-19 21:37:342023-06-19 21:37:36

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-19 21:37:36]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3880kb
  • [2023-06-19 21:37:34]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int smax(int & x, int y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}

int smin(int & x, int y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}


void solve() {
    int n;
    cin >> n;
    int ones = 0;
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        if (x == 1) {
            ones++;
        }
    }
    int twos = n - ones;
    if (twos == 0 && (n % 3 == 1)) {
        cout << "Sprague" << "\n";
    } else if (twos == 1 && (n % 3 <= 1)) {
        cout << "Sprague" << "\n";
    } else {
        cout << "Grundy\n";
    }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    cerr << "Time " << clock() * 1. / CLOCKS_PER_SEC << "\n";
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3696kb

input:

3
2
1 2
1
5
4
1 7 2 9

output:

Grundy
Sprague
Grundy

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 5ms
memory: 3876kb

input:

11337
9
4 1 2 3 2 4 3 2 3
10
1 7 1 5 1 2 2 2 1 3
9
1 3 7 3 3 1 1 3 2
12
1 1 2 4 1 2 2 4 2 2 1 4
15
1 3 4 3 1 2 1 4 1 1 1 1 1 1 1
8
3 3 2 2 3 9 1 2
10
2 2 2 2 1 5 1 2 7 2
10
2 2 2 3 2 2 3 5 2 2
7
2 2 6 2 2 3 5
10
1 1 1 3 1 1 1 5 1 1
8
2 2 2 2 5 2 10 1
5
3 10 1 3 1
8
3 4 2 2 1 1 11 1
6
6 4 8 2 4 2
10
...

output:

Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grund...

result:

ok 11337 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 3780kb

input:

1
100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Sprague

result:

ok single line: 'Sprague'

Test #4:

score: 0
Accepted
time: 7ms
memory: 3868kb

input:

1
100000
226935072 680238422 982585081 396750123 498712414 41068575 397815498 975619613 324859334 264886117 99828622 52238294 539721972 490639983 239475075 751880467 206285542 955026060 758678155 856841937 668559235 854414731 774999211 701519573 621084432 891421251 845930127 139772966 914970812 3880...

output:

Grundy

result:

ok single line: 'Grundy'

Test #5:

score: 0
Accepted
time: 4ms
memory: 3768kb

input:

1
100000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Sprague

result:

ok single line: 'Sprague'

Test #6:

score: 0
Accepted
time: 5ms
memory: 3768kb

input:

10
6919
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Sprague
Grundy
Sprague
Grundy
Sprague
Grundy
Sprague
Grundy
Sprague
Grundy

result:

ok 10 lines

Test #7:

score: 0
Accepted
time: 2ms
memory: 3772kb

input:

100
43
828568162 834535959 598717220 621573425 944954102 231903835 239816640 296497609 477381472 234055632 488734998 389721839 856975650 489078803 996865708 7139094 243013091 31339400 26226279 540921778 569712619 186176471 441270550 256075197 275912874 931021419 488820455 263169075 426482993 2110027...

output:

Grundy
Sprague
Sprague
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Spr...

result:

ok 100 lines

Test #8:

score: 0
Accepted
time: 4ms
memory: 3880kb

input:

1000
12
1 1 1 1 1 1 1 1 1 1 1 1
223
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Grundy
Sprague
Grundy
Grundy
Sprague
Grundy
Grundy
Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Sprague
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy...

result:

ok 1000 lines

Test #9:

score: 0
Accepted
time: 6ms
memory: 3700kb

input:

10000
2
1 1
22
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
7
905072972 42665615 759570155 833866294 500076428 383328175 273973286
2
1 1
2
1 126654824
1
1
4
1 53611459 1 1
2
794423195 1
2
413707763 302409852
3
793107100 210617089 685870463
3
778825522 1 1
33
284575385 255650653 943800196 183635044 15...

output:

Grundy
Sprague
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Sprague
Sprague
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Sprague
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Sprague
Sprague
Grundy
Sprague
Sprague
Grundy
Gr...

result:

ok 10000 lines

Test #10:

score: 0
Accepted
time: 5ms
memory: 3780kb

input:

10
8013
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Sprague
Grundy
Sprague
Grundy
Grundy
Sprague
Sprague
Grundy
Sprague
Sprague

result:

ok 10 lines

Test #11:

score: 0
Accepted
time: 1ms
memory: 3880kb

input:

100
507
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Sprague
Grundy
Sprague
Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Sprague
Sprague
Grundy
Sprague
Grundy
Sprague
Grundy
Sprague
Sprague
Grundy
Spra...

result:

ok 100 lines

Test #12:

score: 0
Accepted
time: 4ms
memory: 3756kb

input:

100
4944
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Sprague
Sprague
Sprague
Sprague
Sprague
Grundy
Grundy
Grundy
G...

result:

ok 100 lines

Test #13:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

1000
8
1 1 1 1 389589087 1 1 1
65
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 48485604 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
13
1 1 1 1 1 1 1 1 58071649 1 1 1 1
8
1 1 1 1 1 25790098 1 1
67
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

Grundy
Grundy
Sprague
Grundy
Sprague
Grundy
Grundy
Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Sprague
Sprague
Grundy
Sprague
Grundy
Grundy
Sprague
Sprague
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Sprague
Sprague
Grundy
Sprague
Grundy
Sprague
Sprague
Sprague
Sprague
Grundy
Spra...

result:

ok 1000 lines

Test #14:

score: 0
Accepted
time: 4ms
memory: 3700kb

input:

1000
16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
130
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

Sprague
Sprague
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Sprague
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Sprague
Grundy
Grundy
Sprague
Gru...

result:

ok 1000 lines