QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#188288#6642. (1, 2) NimqzzyqWA 1ms3428kbC++141.3kb2023-09-25 18:21:182023-09-25 18:21:18

Judging History

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

  • [2023-09-25 18:21:18]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3428kb
  • [2023-09-25 18:21:18]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define maxn
#define put() putchar('\n')
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
using namespace std;
void read(int &x){
    int f=1;x=0;char c=getchar();
    while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();}
    while (c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}
    x*=f;
}
namespace Debug{
	Tp void _debug(char* f,Ty t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,Ty x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	Tp ostream& operator<<(ostream& os,vector<Ty>& V){os<<"[";for(auto& vv:V) os<<vv<<",";os<<"]";return os;}
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
}using namespace Debug;
#define fi first
#define se second
#define mk make_pair
const int mod=1e9+7;
int power(int x,int y=mod-2) {
	int sum=1;
	while (y) {
		if (y&1) sum=sum*x%mod;
		x=x*x%mod;y>>=1;
	}
	return sum;
}
void solve(void) {
	int n,i,x,flag=0;
	read(n);
	for (i=1;i<=n;i++) {
		read(x);
		flag+=(x==1);
	}
	if (n==1) puts("Sprague");
	else if (flag==n&&n%3==1) puts("Sprague");
	else if (flag==n-1&&n%3!=0) puts("Sprague");
	else puts("Grundy");
}
signed main(void){
//	freopen("1.in","r",stdin);
	int T;
	read(T);
	while (T--) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3428kb

input:

3
2
1 2
1
5
4
1 7 2 9

output:

Sprague
Sprague
Grundy

result:

wrong answer 1st lines differ - expected: 'Grundy', found: 'Sprague'