QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#320870 | #8217. King's Dinner | ucup-team484# | AC ✓ | 1ms | 3756kb | C++17 | 1.5kb | 2024-02-03 23:00:12 | 2024-02-03 23:00:13 |
Judging History
answer
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
const int N = 1e6 + 5;
void solve() {
int n; cin >> n;
if (n == 1) {
cout << ".\n";
return;
}
vector<string> a(n);
for (int i = 0; i < n; i++)
a[i] = string(n, '.');
if (n % 6 == 5) {
for (int i = 0; i < n; i += 3) {
for (int j = 0; j < n; j += 2)
a[i][j] = a[i + 1][j] = '#';
}
} else if (n % 6 == 2) {
for (int i = 0; i < n; i += 3) {
for (int j = 0; j + 2 < n; j += 2)
a[i][j] = a[i + 1][j] = '#';
}
for (int i = 0; i < n; i += 2)
a[i][n - 2] = a[i][n - 1] = '#';
} else if (n % 6 == 0 || n % 6 == 4) {
for (int l = 0, r = n - 1; l < r; l += 3, r -= 3) {
for (int i = l; i + 2 < r; i += 2) {
a[l][i] = a[l + 1][i] = '#';
a[r][i + 3] = a[r - 1][i + 3] = '#';
a[i + 3][l] = a[i + 3][l + 1] = '#';
a[i][r] = a[i][r - 1] = '#';
}
}
} else {
n -= 3;
for (int l = 0, r = n - 1; l < r; l += 3, r -= 3) {
for (int i = l; i + 2 < r; i += 2) {
a[l][i] = a[l + 1][i] = '#';
a[r][i + 3] = a[r - 1][i + 3] = '#';
a[i + 3][l] = a[i + 3][l + 1] = '#';
a[i][r] = a[i][r - 1] = '#';
}
}
n += 3;
for (int i = 0; i < n; i += 2) {
a[i][n - 2] = a[i][n - 1] = '#';
if (i + 3 < n)
a[n - 2][i] = a[n - 1][i] = '#';
}
}
for (int i = 0; i < n; i++)
cout << a[i] << "\n";
}
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
int t; cin >> t; while (t--) solve();
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
3 1 2 3
output:
. ## .. .## ... .##
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
50 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
output:
. ## .. .## ... .## #.## #... ...# ##.# #.#.# #.#.# ..... #.#.# #.#.# #.#.## #.#... ....## ##.... ...#.# ##.#.# #.##.## #...... ...#.## ##.#... .....## #.#.... #.#..## #.#.#.## #.#.#... ......## #.#.#... #.#.#.## ........ #.#.#.## #.#.#... #.#.##.## #.#...... ....##.## ##....... ...#.#.## ##.#.#... ...
result:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...... ..............................................##.## ##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##...... ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....##.## ##.........................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3756kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... ........................................................................................## ##.#.#.#.#.#.#.#.#.#.#.#.#....
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.## #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#... .....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed