QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#368986 | #8217. King's Dinner | ucup-team3215# | AC ✓ | 1ms | 3604kb | C++20 | 2.1kb | 2024-03-27 18:49:27 | 2024-03-27 18:49:28 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void put(vector<string> & g, int i, int j, int sh, int n = 0) {
g[sh + i][sh + j] = '#';
if (n) {
put(g, n - 1 - j, i, sh, 0);
}
}
void sol(vector<string> & g, int n, int sh) {
if (n < 2) {
return;
}
if (n == 3) {
put(g, 0, 0, sh);
put(g, 1, 0, sh);
put(g, 0, 2, sh);
put(g, 1, 2, sh);
} else if (n % 3 == 2) {
if (n % 2 == 0) {
for (int i = 0; i < n; i += 3) {
for (int j = 0; j < n - 3; j += 2) {
put(g, j, i, sh);
put(g, j, i + 1, sh);
}
}
for (int i = 0; i < n; i += 2) {
put(g, n - 1, i, sh);
put(g, n - 2, i, sh);
}
} else {
for (int i = 0; i < n; i += 3) {
for (int j = 0; j < n; j += 2) {
put(g, j, i, sh);
put(g, j, i + 1, sh);
}
}
}
} else if (n % 3 == 1) {
for (int i = 0; i < n - 3; i += 3) {
put(g, i, 0, sh, n);
put(g, i + 1, 0, sh, n);
put(g, n - 1 - (i), n - 1, sh, n);
put(g, n - 1 - (i + 1), n - 1, sh, n);
}
sol(g, n - 4, sh + 2);
} else {
for (int i = 0; i < n - 3; i += 3) {
put(g, i, 0, sh, n);
put(g, i + 1, 0, sh, n);
put(g, i, 2, sh, n);
put(g, i + 1, 2, sh, n);
put(g, n - 1 - (i), n - 1, sh, n);
put(g, n - 1 - (i + 1), n - 1, sh, n);
put(g, n - 1 - (i), n - 3, sh, n);
put(g, n - 1 - (i + 1), n - 3, sh, n);
}
sol(g, n - 8, sh + 4);
}
}
void solve() {
int n;
cin >> n;
vector<string> g(n, string(n, '.'));
sol(g, n, 0);
for (const string & s : g) {
cout << s << '\n';
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t;
cin >> t;
while (t--) {
solve();
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3580kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3604kb
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: 3548kb
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: 3588kb
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: 3540kb
input:
1 100
output:
#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #................................................................................................... ..#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##...
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed