QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#821765#8311. Game on SequenceBrno (Bocheng Jiang, Zhenyu Wang, Taixiang Wang)#WA 1ms7712kbC++20850b2024-12-19 17:56:582024-12-19 17:57:00

Judging History

This is the latest submission verdict.

  • [2024-12-19 17:57:00]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 7712kb
  • [2024-12-19 17:56:58]
  • Submitted

answer

#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
const int N=200010,M=2000010,INF=0x3f3f3f3f;
int n,m,a[N],t[N],f[N],v[N];
pair<int,int> b[N];
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		t[a[i]]=max(t[a[i]],i);
	}
	while(m--){
		int op,k;
		cin>>op>>k;
		if(op&1){
			a[++n]=k,t[k]=n;
			for(int i=0;i<(1<<8);i++){
				b[i]=mp(t[i],i);
				v[i]=f[i]=0;
			}
			sort(b,b+255);
			for(int i=(1<<8)-1;i>=0;i--){
				int S=b[i].se;
				for(int j=0;j<8;j++)
					if(v[S^(1<<j)])f[S]|=!f[S^(1<<j)];
				v[S]=1;
			}
		}
		else{
			if(k<t[a[k]])cout<<"Grammy\n";
			else cout<<(f[k]?"Grammy\n":"Alice\n");
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 5
1 2 3 4 5
1 6
2 5
1 7
2 5
2 1

output:

Alice
Grammy
Alice

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3612kb

input:

10 10
12 114 132 7 133 53 128 159 34 92
2 5
1 254
2 3
2 11
1 92
2 11
1 33
1 230
1 181
2 11

output:

Alice
Grammy
Grammy
Grammy
Grammy

result:

wrong answer 3rd lines differ - expected: 'Alice', found: 'Grammy'