QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#121790 | #6189. Full Clue Problem | UndertrainedOverpressure# | AC ✓ | 1ms | 3500kb | C++23 | 1.9kb | 2023-07-08 20:53:19 | 2023-07-08 20:53:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define TIME (clock() * 1.0 / CLOCKS_PER_SEC)
void solve() {
int n;
cin >> n;
if (n == 2) {
cout << "2 3\n" \
"3 2\n" \
"\n" \
"1 1\n" \
"1 0\n" \
"\n" \
"0 1\n" \
"1 1\n";
return;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (i == 0 && j == 0) {
cout << "3 ";
continue;
}
if (i == n - 1 && j == n - 1) {
cout << "3 ";
continue;
}
if (abs(i - j) <= 1) {
cout << "2 ";
continue;
}
if (abs(i - j) == 2) {
cout << "1 ";
continue;
}
cout << "0 ";
}
cout << "\n";
}
cout << "\n";
vector<vector<int>> ans(n, vector<int>(n, 0));
auto add = [&](int i, int j) {
if (i < n && j < n) {
ans[i][j] = 1;
}
};
int x = 0;
int y = 0;
for (int i = 0; i < n; i++) {
add(x, y);
add(x + 1, y);
add(x + 1, y + 1);
add(x + 1, y + 2);
x += 2;
y += 2;
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << ans[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cout << ans[j][i] << " ";
}
cout << "\n";
}
}
int main() {
#ifdef ONPC
freopen("input", "r", stdin);
#endif
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3440kb
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: 3392kb
input:
2
output:
2 3 3 2 1 1 1 0 0 1 1 1
result:
ok ok
Test #3:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
3
output:
3 2 1 2 2 2 1 2 3 1 0 0 1 1 1 0 0 1 1 1 0 0 1 0 0 1 1
result:
ok ok
Test #4:
score: 0
Accepted
time: 0ms
memory: 3424kb
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: 3444kb
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: 3500kb
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: 0ms
memory: 3408kb
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