QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#473341#8830. Breaking BadPhantomThresholdWA 155ms11096kbC++202.6kb2024-07-12 02:03:532024-07-12 02:03:54

Judging History

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

  • [2024-07-12 02:03:54]
  • 评测
  • 测评结果:WA
  • 用时:155ms
  • 内存:11096kb
  • [2024-07-12 02:03:53]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<vector<int>> a(n+5,vector<int>(n+5));
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			cin>>a[i][j];
		}
	}
	mt19937 rng(58);
	vector<int> ok(5);
	int del=0;
	for(int tt=1;tt<=10;tt++)
	{
		random_shuffle(a.begin()+1,a.begin()+n+1,[&](int x){return rng()%x;});
		vector<int> cp(n+5);
		for(int i=1;i<=n;i++)
			cp[i]=i;
		random_shuffle(cp.begin()+1,cp.begin()+n+1,[&](int x){return rng()%x;});
		auto b=a;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
				a[i][j]=b[i][cp[j]];
		for(int i=1;i<=n;i++)
		{
			int t=a[i][1];
			del+=t;
			for(int j=1;j<=n;j++)
			{
				a[i][j]-=t;
			}
		}
		for(int j=1;j<=n;j++)
		{
			int t=a[1][j];
			del+=t;
			for(int i=1;i<=n;i++)
			{
				a[i][j]-=t;
			}
		}
		sort(a.begin()+1,a.begin()+n+1);
		for(int i=1;i<=n;i++)
			for(int j=i+1;j<=n;j++)
				swap(a[i][j],a[j][i]);
		sort(a.begin()+1,a.begin()+n+1);
		/*
		int r0=0,c0=0;
		for(int i=1;i<=n;i++)
		{
			int all0=1;
			for(int j=1;j<=n;j++)
			{
				if(a[i][j]!=0)
				{
					all0=0;
					break;
				}
			}
			if(not all0)break;
			r0=i;
		}
		for(int j=1;j<=n;j++)
		{
			int all0=1;
			for(int i=1;i<=n;i++)
			{
				if(a[i][j]!=0)
				{
					all0=0;
					break;
				}
			}
			if(not all0)break;
			c0=j;
		}
		*/
		vector<int> banr(n+5),banc(n+5);
		for(int i=1;i<=n;i++)
		{
			if(a[i]==a[i-1])
				banr[i]=banr[i-1]+1;
		}
		for(int j=1;j<=n;j++)
		{
			int chk=1;
			for(int i=1;i<=n;i++)
			{
				if(a[i][j]!=a[i-1][j])
				{
					chk=0;
					break;
				}
			}
			if(chk)
				banc[j]=banc[j-1]+1;
		}
	//	int cr=0,cc=0;
		for(int i=1;i<=n;i++)
		{
			if(banr[i]>=4)banr[i]=1;
			else banr[i]=0;
			if(banc[i]>=4)banc[i]=1;
			else banc[i]=0;
		}
		int ii=1,jj=1;
		while(ii<=n and jj<=n)
		{
			while(ii<=n and not banr[ii])ii++;
			while(jj<=n and not banc[jj])jj++;
			if(banr[ii] and banc[jj])
			{
				del+=a[ii][jj];
				ii++,jj++;
			}
		}
		while(ii<=n)banr[ii]=0,ii++;
		while(jj<=n)banc[jj]=0,jj++;
		
		vector<int> p1(n+5),p0;
		for(int i=1;i<=n;i++)
		{
			if(not banc[i])
				p0.push_back(i);
		}
		
	//	mt19937 rng(58);
		const int R=100;
		for(int tt=1;tt<=R;tt++)
		{
			random_shuffle(p0.begin(),p0.end(),[&](int x){return rng()%x;});
			int idx=0;
			for(int i=1;i<=n;i++)
			{
				if(not banr[i])
					p1[i]=p0[idx++];
			}
			int s=0;
			for(int i=1;i<=n;i++)
			{
				if(p1[i])
					s+=a[i][p1[i]];
			}
			ok[(s+del)%5]=1;
		}
	}
	for(int i=0;i<5;i++)
		cout<<"NY"[ok[i]];
	return 0;
}

详细

Test #1:

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

input:

2
0 4
4 0

output:

YNNYN

result:

ok "YNNYN"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

2
1 1
1 1

output:

NNYNN

result:

ok "NNYNN"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3496kb

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: 0ms
memory: 3628kb

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

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:

NYNNY

result:

ok "NYNNY"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3832kb

input:

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

output:

YYYNY

result:

ok "YYYNY"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

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

output:

NYYYY

result:

ok "NYYYY"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

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

output:

NYNNN

result:

ok "NYNNN"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

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

output:

YYYYY

result:

ok "YYYYY"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

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

output:

NNNYN

result:

ok "NNNYN"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

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

output:

YYYYY

result:

ok "YYYYY"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

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

output:

YNYNY

result:

ok "YNYNY"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

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

output:

YYYNY

result:

ok "YYYNY"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

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

output:

YNYNN

result:

ok "YNYNN"

Test #15:

score: 0
Accepted
time: 149ms
memory: 11044kb

input:

1000
3 4 1 2 4 1 0 3 0 4 1 4 3 1 4 4 1 0 1 2 3 1 0 1 3 4 4 0 3 0 3 2 2 1 0 4 1 3 3 0 3 1 3 2 2 0 3 3 2 2 3 0 4 2 1 2 1 2 1 4 2 4 1 4 2 4 3 2 0 3 0 4 2 1 2 3 3 0 2 0 3 3 1 1 0 3 4 3 2 0 4 0 3 4 4 2 3 4 2 3 4 2 1 3 2 2 4 1 0 2 2 4 0 1 2 0 4 1 3 2 3 2 2 2 1 4 4 4 2 0 0 4 4 1 3 4 0 2 2 3 1 1 3 2 3 2 3 0...

output:

NNNYN

result:

ok "NNNYN"

Test #16:

score: -100
Wrong Answer
time: 155ms
memory: 11096kb

input:

1000
2 3 0 1 0 0 0 1 1 4 1 4 2 3 0 3 4 2 3 2 4 2 1 1 1 1 0 0 3 3 2 0 2 2 2 4 3 0 3 3 3 0 1 3 0 2 0 1 0 0 0 3 1 4 3 1 4 0 3 4 4 1 3 3 4 0 1 4 2 3 0 1 0 0 2 3 1 4 0 0 2 1 2 3 3 4 4 3 3 2 0 0 4 3 2 3 3 2 4 0 2 2 3 0 3 2 4 1 0 2 4 2 4 1 2 1 3 0 3 3 0 1 1 0 2 3 0 2 4 1 4 3 4 1 2 2 2 4 0 1 3 3 0 0 1 3 2 4...

output:

NYNNY

result:

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