QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#863524#8830. Breaking BadLiWenXWA 0ms5844kbC++20907b2025-01-19 18:44:082025-01-19 18:44:09

Judging History

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

  • [2025-01-19 18:44:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:5844kb
  • [2025-01-19 18:44:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int c[1<<5][5];
int n,A[1005][1005],a[1005][1005];
int p1[1005],p2[1005];
mt19937 rd(time(NULL));
int f[1005];
int solve(){
	shuffle(p1+1,p1+1+n,rd);
	shuffle(p2+1,p2+1+n,rd);
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			a[i][j]=A[p1[i]][p2[j]];
		}
	}
	f[0]=1;
	for(int i=1;i<=n;i++){
		int s=0;
		for(int j=i;j<=n;j++){
			f[j]|=c[f[i-1]][(s+a[j][i])%5];
			s+=a[j][j+1];
			s%=5;
		}
	}
	return f[n];
}
int main(){
	for(int i=0;i<(1<<5);i++){
		for(int j=0;j<5;j++){
			for(int k=0;k<5;k++){
				int x=(j+k)%5;
				if((i>>k)&1){
					c[i][j]|=(1<<x);
				}
			}
		}
	}
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++){
			cin>>A[i][j];
		}
		p1[i]=p2[i]=i;
	}
	int ans=0;
	for(int i=1;i<=300;i++) ans|=solve();
	for(int i=0;i<5;i++){
		if((ans>>i)&1){
			cout<<"Y";
		}
		else cout<<"N";
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5844kb

input:

2
0 4
4 0

output:

YNNYY

result:

wrong answer 1st words differ - expected: 'YNNYN', found: 'YNNYY'