QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#177236#6189. Full Clue ProblemPhantomThreshold#AC ✓1ms3520kbC++201.3kb2023-09-12 18:28:062023-09-12 18:28:06

Judging History

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

  • [2023-09-12 18:28:06]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3520kb
  • [2023-09-12 18:28:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	if(n==2)
	{
		cout<<2<<' '<<3<<endl;
		cout<<3<<' '<<2<<endl;
		cout<<endl;
		cout<<1<<' '<<1<<endl;
		cout<<1<<' '<<0<<endl;
		cout<<endl;
		cout<<0<<' '<<1<<endl;
		cout<<1<<' '<<1<<endl;
		return 0;
	}
	vector<vector<int>> a(n+5,vector<int>(n+5));
	a[1][1]=a[1][2]=a[1][3]=a[2][1]=a[3][1]=2;
	a[n][n]=a[n][n-1]=a[n][n-2]=a[n-1][n]=a[n-2][n]=2;
	for(int i=4;i<=n;i++)
	{
		a[i-3][i]=a[i-2][i-1]=a[i-1][i-2]=a[i][i-3]=1;
		a[i-2][i]=a[i][i-2]=2;
	}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cout<<a[i][j]<<" \n"[j==n];
	cout<<endl;
	vector<vector<int>> b1(n+5,vector<int>(n+5));
	for(int i=2;i<=n;i++)
		b1[i-1][i]=b1[i][i-1]=1;
	for(int i=2;i<=n-1;i++)
		b1[i][i]=1;
	auto b2=b1;
	int fl=0;
	for(int i=3;i<=n;i++)
	{
		if(fl)
			b2[i-2][i]=1;
		else
			b1[i-2][i]=1;
		fl^=1;
	}
	if(fl)
		b2[n][n]=1;
	else
		b1[n][n]=1;
	fl^=1;
	for(int i=n;i>=3;i--)
	{
		if(fl)
			b2[i][i-2]=1;
		else
			b1[i][i-2]=1;
		fl^=1;
	}
	if(fl)
		b2[1][1]=1;
	else
		b1[1][1]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cout<<b1[i][j]<<" \n"[j==n];
	cout<<endl;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			cout<<b2[i][j]<<" \n"[j==n];
	cout<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3440kb

input:

5

output:

2 2 2 1 0
2 0 1 2 1
2 1 0 1 2
1 2 1 0 2
0 1 2 2 2

0 1 1 0 0
1 1 1 0 0
1 1 1 1 1
0 0 1 1 1
0 0 1 1 0

1 1 0 0 0
1 1 1 1 0
0 1 1 1 0
0 1 1 1 1
0 0 0 1 1


result:

ok ok

Test #2:

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

input:

2

output:

2 3
3 2

1 1
1 0

0 1
1 1

result:

ok ok

Test #3:

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

input:

3

output:

2 2 2
2 0 2
2 2 2

0 1 1
1 1 1
1 1 0

1 1 0
1 1 1
0 1 1


result:

ok ok

Test #4:

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

input:

4

output:

2 2 2 1
2 0 1 2
2 1 0 2
1 2 2 2

0 1 1 0
1 1 1 0
1 1 1 1
0 0 1 1

1 1 0 0
1 1 1 1
0 1 1 1
0 1 1 0


result:

ok ok

Test #5:

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

input:

10

output:

2 2 2 1 0 0 0 0 0 0
2 0 1 2 1 0 0 0 0 0
2 1 0 1 2 1 0 0 0 0
1 2 1 0 1 2 1 0 0 0
0 1 2 1 0 1 2 1 0 0
0 0 1 2 1 0 1 2 1 0
0 0 0 1 2 1 0 1 2 1
0 0 0 0 1 2 1 0 1 2
0 0 0 0 0 1 2 1 0 2
0 0 0 0 0 0 1 2 2 2

0 1 1 0 0 0 0 0 0 0
1 1 1 0 0 0 0 0 0 0
1 1 1 1 1 0 0 0 0 0
0 0 1 1 1 0 0 0 0 0
0 0 1 1 1 1 1 0 0 0...

result:

ok ok

Test #6:

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

input:

19

output:

2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0
0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0
0 0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0
0 0 0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0
0 0 0 0 1 2 1 0 1 2 1 0 0 0 0 0 0 ...

result:

ok ok

Test #7:

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

input:

20

output:

2 2 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 2 1 0 1 2 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 1 2 1 0 1 2 ...

result:

ok ok