QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#343466 | #6189. Full Clue Problem | ucup-team1198# | AC ✓ | 1ms | 3832kb | C++20 | 1.7kb | 2024-03-02 16:49:16 | 2024-03-02 16:49:16 |
Judging History
answer
#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
const int MAXN = 30;
int a[MAXN][MAXN];
void col(int i) {
for (int x = 0; x < 3; ++x) {
for (int y = 0; y < 3; ++y) {
if (x + y == 4) continue;
a[i + x][i + y] = 1;
}
}
}
vector<int> dx = {0, 1, 0, -1}, dy = {1, 0, -1, 0};
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i += 2) {
col(i);
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
int cnt = 0;
for (int t = 0; t < 4; ++t) {
int i1 = i + dx[t], j1 = j + dy[t];
if (i1 >= 1 && i1 <= n && j1 >= 1 && j1 <= n && a[i1][j1] != a[i][j]) ++cnt;
if ((i1 < 1 || i1 > n || j1 < 1 || j1 > n) && a[i][j]) ++cnt;
}
cout << cnt << " ";
}
cout << "\n";
}
cout << "\n";
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
cout << a[i][j] << " ";
a[i][j] = 0;
}
cout << "\n";
}
cout << "\n";
col(1);
a[1][1] = 0;
for (int i = 3; i < n; i += 2) {
col(i);
}
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
cout << a[i][j] << " ";
a[i][j] = 0;
}
cout << "\n";
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3532kb
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: 0ms
memory: 3532kb
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: 3468kb
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: 0ms
memory: 3632kb
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: 3572kb
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: 0ms
memory: 3532kb
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: 0ms
memory: 3832kb
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