QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#458454#8830. Breaking Baducup-team3586#WA 6ms11612kbC++231.3kb2024-06-29 17:23:422024-06-29 17:23:42

Judging History

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

  • [2024-06-29 17:23:42]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:11612kb
  • [2024-06-29 17:23:42]
  • 提交

answer

//Code by dXqwq, who is still searching painless suicide.
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
// #define int long long
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
const int p=5;
mt19937 rnd(20080520);
int a[1003][1003],t[1003][1003];
int b[1003],c[1003];
bool f[1003][5],ans[5];
signed main()
{
	int n=read();
	for(int i=1; i<=n; ++i)
		for(int j=1; j<=n; ++j)
			a[i][j]=read();
	for(int i=1; i<=n; ++i) b[i]=c[i]=i;
	for(int T=10; T--;)
	{
		shuffle(b+1,b+n+1,rnd);
		shuffle(c+1,c+n+1,rnd);
		for(int i=1; i<=n; ++i)
			for(int j=1; j<=n; ++j)
				t[b[i]][c[j]]=a[i][j];
		swap(a,t);
		int s=0;
		for(int i=1; i<=n; ++i)
			s+=a[i][i];
		ans[s%5]=1;
		memset(f,0,sizeof(f)),f[0][0]=1;
		for(int i=1; i<=n; ++i)
			for(int j=i,d=0; j<=n; ++j)
			{
				d+=a[j][i];
				for(int k=0; k<p; ++k)
					f[j][(k+d)%p]|=f[i-1][k];
				d-=a[j][i];
				d+=a[j][j+1];
			}
	}
	for(int i=0; i<5; ++i)
		if(ans[i]) putchar('Y');
		else putchar('N');
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 11604kb

input:

2
0 4
4 0

output:

YNNYN

result:

ok "YNNYN"

Test #2:

score: 0
Accepted
time: 3ms
memory: 11532kb

input:

2
1 1
1 1

output:

NNYNN

result:

ok "NNYNN"

Test #3:

score: 0
Accepted
time: 3ms
memory: 11612kb

input:

4
0 0 1 0
0 1 0 1
0 0 0 0
1 1 0 0

output:

YYYYN

result:

ok "YYYYN"

Test #4:

score: 0
Accepted
time: 6ms
memory: 11612kb

input:

4
0 0 0 1
0 1 0 1
1 0 0 0
0 1 0 0

output:

YYYYN

result:

ok "YYYYN"

Test #5:

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

input:

10
1 4 2 0 0 2 0 1 3 3
0 3 1 4 4 1 4 0 2 2
1 4 2 0 0 2 0 1 0 3
0 3 1 4 4 1 4 0 2 2
4 2 0 3 3 0 3 4 1 1
2 0 3 1 1 3 1 2 4 4
4 2 0 3 3 0 3 4 1 1
2 0 3 1 1 3 1 2 4 4
1 4 2 0 0 2 0 1 3 3
3 1 4 2 2 4 2 3 0 0

output:

NNNNY

result:

wrong answer 1st words differ - expected: 'NYNNY', found: 'NNNNY'