QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#127019#6642. (1, 2) Nimoreoioiwy#WA 3ms3596kbC++171.3kb2023-07-19 12:20:482023-07-19 12:20:52

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-19 12:20:52]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:3596kb
  • [2023-07-19 12:20:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

// #define tpyeinput int
// inline char nc() {static char buf[1000000],*p1=buf,*p2=buf;return p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++;}
// inline void read(tpyeinput &sum) {char ch=nc();sum=0;while(!(ch>='0'&&ch<='9')) ch=nc();while(ch>='0'&&ch<='9') sum=(sum<<3)+(sum<<1)+(ch-48),ch=nc();}

template<typename T>
void read(T &x) {
    int f = 1;
    x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-')f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = x * 10 + (ch ^ 48);
        ch = getchar();
    }
    x *= f;
}

const int N = 1e6+10, M = 2*N;

void solve() {
    int n; read(n);
    int ones = 0, twos = 0;
    for(int i=0;i<n;i++)
    {
        int x;
        read(x);
        if(x == 1) ones++;
        else twos++;
    }
    if(n == 1)
    {
        puts("Sprague");
        return;
    }
    if(ones % 3 == 2 && twos == 1)
    {
        puts("Sprague");
        return;
    }
    puts("Grundy");
}

int main() {
#ifdef LOCAL_TEST
    freopen("test.in", "r", stdin);
#endif
    int times = 1;
    read(times);
    while(times--) {
        solve();   
    }
    return 0;
}

詳細信息

Test #1:

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

input:

3
2
1 2
1
5
4
1 7 2 9

output:

Grundy
Sprague
Grundy

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 3ms
memory: 3424kb

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
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy
Grundy...

result:

wrong answer 22nd lines differ - expected: 'Sprague', found: 'Grundy'