QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#94772 | #6189. Full Clue Problem | team404# | AC ✓ | 2ms | 3488kb | C++14 | 2.7kb | 2023-04-07 18:02:18 | 2023-04-07 18:02:22 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
int a[2][25][25];
int b[25][25];
int f[25][25];
signed main()
{
int n;
cin >> n;
for (int i = 0; i <= n + 1; i++)
{
for (int j = 0; j <= n + 1; j++)
{
a[0][i][j] = a[1][i][j] = 0;
}
}
int m = n - 1;
int k1, k2;
if(n == 2){
cout << "2 3\n3 2\n\n";
cout << "1 1\n1 0\n\n";
cout << "0 1\n1 1\n";
return 0;
}
if(m%2 == 1){
//cout << m << endl;
for (int i = 1; i <= (m + 1) / 2; i++)
f[0][i] = 3;
f[0][1] = 2;
for (int i = 1; i <= (m + 1) / 2;i++)
f[1][i] = 3;
f[1][(m + 1) / 2] = 2;
k1 = (m + 1) / 2;
k2 = (m + 1) / 2;
}
else{
for (int i = 1; i <= m / 2 + 1; i++)
f[0][i] = 3;
f[0][1] = 2;
f[0][m / 2 + 1] = 2;
for (int i = 1; i <= m / 2; i++)
f[1][i] = 3;
k1 = m / 2 + 1;
k2 = m / 2;
}
int now = 1;
for (int i = 1; i <= k1; i++){
for (int j = 0; j < f[0][i]; j++){
for (int k = 0; k < f[0][i]; k++){
a[0][now + j][now + k] = 1;
}
}
now += f[0][i] - 1;
}
if(f[0][1] == 3)
a[0][1][1] = 0;
if(f[0][k1] == 3)
a[0][n][n] = 0;
now = 1;
for (int i = 1; i <= k2; i++)
{
for (int j = 0; j < f[1][i]; j++)
{
for (int k = 0; k < f[1][i]; k++)
{
a[1][now + j][now + k] = 1;
}
}
now += f[1][i] - 1;
}
if (f[1][1] == 3)
a[1][1][1] = 0;
if (f[1][k2] == 3)
a[1][n][n] = 0;
for (int i = 1; i <= n; i++){
for (int j = 1; j <= n; j++){
f[i][j] = 0;
if (a[0][i][j] != a[0][i - 1][j])
f[i][j]++;
if (a[0][i][j] != a[0][i + 1][j])
f[i][j]++;
if (a[0][i][j] != a[0][i][j - 1])
f[i][j]++;
if (a[0][i][j] != a[0][i][j + 1])
f[i][j]++;
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
cout << f[i][j] << ' ';
}
cout << endl;
}
cout << endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
cout << a[0][i][j] << ' ';
}
cout << endl;
}
cout << endl;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
cout << a[1][i][j] << ' ';
}
cout << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3280kb
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 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 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
result:
ok ok
Test #2:
score: 0
Accepted
time: 1ms
memory: 3280kb
input:
2
output:
2 3 3 2 1 1 1 0 0 1 1 1
result:
ok ok
Test #3:
score: 0
Accepted
time: 2ms
memory: 3392kb
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: 2ms
memory: 3488kb
input:
4
output:
2 2 2 1 2 0 1 2 2 1 0 2 1 2 2 2 1 1 0 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 1 0 0 1 1
result:
ok ok
Test #5:
score: 0
Accepted
time: 0ms
memory: 3468kb
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 1 1 0 0 0 0 0 0 0 0 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 0 0 0 0...
result:
ok ok
Test #6:
score: 0
Accepted
time: 2ms
memory: 3296kb
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...
result:
ok ok
Test #7:
score: 0
Accepted
time: 2ms
memory: 3412kb
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...
result:
ok ok