QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#141497#6189. Full Clue Problemrain_sboxAC ✓1ms3532kbC++141.4kb2023-08-17 15:19:252023-08-17 15:19:27

Judging History

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

  • [2023-08-17 15:19:27]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3532kb
  • [2023-08-17 15:19:25]
  • 提交

answer

/*
Problem: F. Full Clue Problem
Contest: qoj
URL: https://qoj.ac/contest/1195/problem/6189
===================
Memory Limit: 1024.0MB
TimeLimit: 1.0s
*/
#include <iostream>

const int MAXN = 29;
using namespace std;

int hsh[MAXN][MAXN], N;
bool ans1[MAXN][MAXN], ans2[MAXN][MAXN];

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cerr.tie(0);
	cin >> N;
	if (N == 2) {
		cout << "2 3\n3 2\n\n1 1\n1 0\n\n0 1\n1 1\n";
		return 0;
	}
	if (N == 3) {
		cout << "2 2 2\n2 0 2\n2 2 2\n\n1 1 0\n1 1 1\n0 1 1\n\n0 1 1\n1 1 1\n1 1 0\n";
		return 0;
	}
	for (int i = 1; i < N-1; i++) hsh[i][i+2] = hsh[i+2][i] = 1;
	for (int i = 1; i < N+1; i++) hsh[i][i] = 2;
	for (int i = 1; i < N; i++) hsh[i][i+1] = hsh[i+1][i] = 2;
	hsh[1][1] = hsh[N][N] = 3;
	for (int i = 1; i < N+1; i++) ans1[i][i] = 1;
	for (int i = 1; i < N+1; i+=2) ans1[i+1][i] = ans1[i+1][i+2] = 1;
	for (int i = 1; i < N+1; i++)
		for (int m = 1; m < N+1; m++) ans2[i][m] = ans1[m][i];
	
	for (int i = 1; i < N+1; i++) {
		for (int m = 1; m < N+1; m++) cout << hsh[i][m] << ' ';
		cout << '\n';
	}
	cout << '\n';
	for (int i = 1; i < N+1; i++) {
		for (int m = 1; m < N+1; m++) cout << ans1[i][m] << ' ';
		cout << '\n';
	}
	cout << '\n';
	for (int i = 1; i < N+1; i++) {
		for (int m = 1; m < N+1; m++) cout << ans2[i][m] << ' ';
		cout << '\n';
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5

output:

3 2 1 0 0 
2 2 2 1 0 
1 2 2 2 1 
0 1 2 2 2 
0 0 1 2 3 

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

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

result:

ok ok

Test #2:

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

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: 3532kb

input:

3

output:

2 2 2
2 0 2
2 2 2

1 1 0
1 1 1
0 1 1

0 1 1
1 1 1
1 1 0

result:

ok ok

Test #4:

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

input:

4

output:

3 2 1 0 
2 2 2 1 
1 2 2 2 
0 1 2 3 

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

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

result:

ok ok

Test #5:

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

input:

10

output:

3 2 1 0 0 0 0 0 0 0 
2 2 2 1 0 0 0 0 0 0 
1 2 2 2 1 0 0 0 0 0 
0 1 2 2 2 1 0 0 0 0 
0 0 1 2 2 2 1 0 0 0 
0 0 0 1 2 2 2 1 0 0 
0 0 0 0 1 2 2 2 1 0 
0 0 0 0 0 1 2 2 2 1 
0 0 0 0 0 0 1 2 2 2 
0 0 0 0 0 0 0 1 2 3 

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

result:

ok ok

Test #6:

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

input:

19

output:

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

result:

ok ok

Test #7:

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

input:

20

output:

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

result:

ok ok