QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#821753#8311. Game on SequenceBrno (Bocheng Jiang, Zhenyu Wang, Taixiang Wang)#WA 1ms5740kbC++20862b2024-12-19 17:52:292024-12-19 17:52:29

Judging History

This is the latest submission verdict.

  • [2024-12-19 17:52:29]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 5740kb
  • [2024-12-19 17:52:29]
  • 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[a[n]]=n;
			for(int i=0;i<(1<<8);i++){
				b[i]=mp(t[i],i);
				v[i]=f[i]=0;
			}
			sort(b+1,b+255+1);
			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: 0ms
memory: 3608kb

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: 0
Accepted
time: 1ms
memory: 5740kb

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
Alice
Alice
Alice

result:

ok 5 lines

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 5700kb

input:

100 100
57 58 24 217 80 0 241 175 19 138 231 17 8 19 22 100 133 205 178 67 55 92 127 254 156 89 87 22 136 208 168 195 164 194 243 110 234 164 78 55 43 223 227 112 137 78 111 31 253 194 196 128 210 129 71 129 40 195 114 69 114 52 83 162 248 117 12 162 86 155 81 6 251 174 237 190 171 44 61 114 254 131...

output:

Alice
Grammy
Grammy
Alice
Alice
Grammy
Grammy
Alice
Grammy
Grammy
Grammy
Grammy
Grammy
Alice
Grammy
Alice
Grammy
Grammy
Grammy
Grammy
Alice
Alice
Grammy
Alice
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Grammy
Alice
Grammy
Grammy
Grammy
Grammy
Alice
Alice
Grammy
Gram...

result:

wrong answer 1st lines differ - expected: 'Grammy', found: 'Alice'