QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#424688#8748. 简单博弈skylineWA 98ms6748kbC++202.6kb2024-05-29 15:28:422024-05-29 15:28:43

Judging History

This is the latest submission verdict.

  • [2024-05-29 15:28:43]
  • Judged
  • Verdict: WA
  • Time: 98ms
  • Memory: 6748kb
  • [2024-05-29 15:28:42]
  • Submitted

answer

#pragma GCC optimize("O2")
#include<bits/stdc++.h>
#define ll   long long
#define pb   emplace_back
#define mp   make_pair
#define orz  1000000007
#define fi   first
#define se   second
using namespace std;
int T,ans;
int pcx[522][4],pcy[522][4],pc[522][4][4],pb[522],fx[522][6],fy[522][6],fz[522];
vector<pair<int,int>> v[505];
vector<int> V;
int dp[2][505][522];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for(int _=0;_<512;++_){
		int a=(_&7),b=((_>>3)&7),c=(_>>6);
		fx[_][0]=(((a<<3)|b)<<3)|c;
		fx[_][1]=(((a<<3)|c)<<3)|b;
		fx[_][2]=(((b<<3)|a)<<3)|c;
		fx[_][3]=(((b<<3)|c)<<3)|a;
		fx[_][4]=(((c<<3)|a)<<3)|b;
		fx[_][5]=(((c<<3)|b)<<3)|a;
	}
	for(int _=0;_<512;++_){
		int a=(_&73),b=(_&146)>>1,c=(_&292)>>2;
		fy[_][0]=(((a<<1)|b)<<1)|c;
		fy[_][1]=(((a<<1)|c)<<1)|b;
		fy[_][2]=(((b<<1)|a)<<1)|c;
		fy[_][3]=(((b<<1)|c)<<1)|a;
		fy[_][4]=(((c<<1)|a)<<1)|b;
		fy[_][5]=(((c<<1)|b)<<1)|a;
	}
	for(int _=0;_<512;++_){
		for(int i=0;i<3;++i){
			for(int j=0;j<3;++j)if(_&(1<<(i*3+j)))fz[_]|=(1<<(j*3+i));
		}
		fz[_]=min(fz[_],_);
	}
	for(int _=0;_<512;++_){
		for(int i=0;i<3;++i){
			for(int j=0;j<3;++j)if(_&(1<<(i*3+j)))++pcx[_][i],++pcy[_][j];
		}
		pb[_]=_;
		for(int i=0;i<6;++i){
			for(int j=0;j<6;++j)pb[_]=min(pb[_],fz[fx[fy[_][j]][i]]);
		}
	}
	for(int _=0;_<512;++_){
		int X[4]={_,_,_,_},Y[4]={_,_,_,_};
		for(int i=0;i<3;++i){
			for(int j=0;j<3;++j)if(_&(1<<(i*3+j)))X[i]^=(1<<(i*3+j)),Y[j]^=(1<<(i*3+j));
		}
		for(int i=0;i<4;++i){
			for(int j=0;j<4;++j)pc[_][i][j]=pb[X[i]&Y[j]];
		}
	}
	for(int _=0;_<512;++_)if(__builtin_popcount(_)<=3&&pb[_]==_)V.pb(_);
	cin>>T;
	while(T--){
		int n,m,_=0;
		cin>>n>>m;
		map<int,int> mx,my;
		int X=0,Y=0;
		for(int i=0;i<3;++i){
			int x,y;
			cin>>x>>y;
			if(!mx.count(x))mx[x]=X++;
			if(!my.count(y))my[y]=Y++;
			_|=(1<<(mx[x]*3+my[y]));
		}
		v[n].pb(mp(m,pb[_]));
	}
	int o=0,p=1;
	for(int n=1;n<=500;++n){
		for(int m=1;m<=500;++m){
			for(auto _:V){
				int s=0;
				int I[4]={},J[4]={};
				for(int i=0;i<4;++i)if(i<n&&m>pcx[_][i])I[i]=1;
				for(int j=0;j<4;++j)if(j<m&&n>pcy[_][j])J[j]=1;
				for(int i=min(3,n-1);i>=0;--i){
					for(int j=min(3,m-1);j>=0;--j)if(I[i]|J[j])s|=(1<<dp[o][m-1][pc[_][i][j]]);
				}
				for(int i=min(3,n-1);i>=0;--i)if(I[i])s|=(1<<dp[o][m][pc[_][i][3]]);
				for(int j=min(3,m-1);j>=0;--j)if(J[j])s|=(1<<dp[p][m-1][pc[_][3][j]]);
				dp[p][m][_]=__builtin_ctz(~s);
			}
		}
		for(auto P:v[n])ans^=dp[p][P.fi][P.se];
		swap(o,p);
	}
	if(ans)cout<<"OvO\n";
	else cout<<"QAQ\n";
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 97ms
memory: 6712kb

input:

100000
215 4
6 1
59 1
71 4
1 482
1 311
1 381
1 26
3 428
3 81
2 359
1 310
222 220
108 40
16 2
11 79
4 223
4 73
4 103
3 51
214 442
174 261
186 418
202 379
146 464
61 193
85 102
117 206
3 1
3 1
2 1
1 1
357 356
199 222
97 15
257 15
30 2
28 2
4 1
12 2
308 308
32 110
56 157
234 171
347 346
243 89
166 140
...

output:

OvO

result:

ok single line: 'OvO'

Test #2:

score: -100
Wrong Answer
time: 98ms
memory: 6748kb

input:

100000
494 303
141 173
343 269
451 163
4 370
4 46
1 100
3 135
226 3
21 3
116 1
47 3
77 52
65 27
19 4
69 50
205 235
164 101
106 183
27 16
4 2
3 2
1 2
4 2
364 364
54 50
155 83
21 181
432 434
295 302
332 91
258 264
324 326
136 171
239 155
300 81
1 4
1 3
1 2
1 4
177 435
20 326
170 256
175 179
1 4
1 3
1 ...

output:

OvO

result:

wrong answer 1st lines differ - expected: 'QAQ', found: 'OvO'