QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#541542 | #8217. King's Dinner | DrAlfred | AC ✓ | 2ms | 3600kb | C++23 | 2.2kb | 2024-08-31 19:55:44 | 2024-08-31 19:55:46 |
Judging History
answer
#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(x...)
#endif
using namespace std;
int t, n;
inline void solve(void) {
cin >> n, n++;
vector<string> mp(n, string(n, '.'));
auto place = [&](int x, int y, int d) {
if (d == 1) { // 竖着
mp[x][y] = mp[x + 1][y] = '#';
} else {
mp[x][y] = mp[x][y + 1] = '#';
}
};
int tmp = n;
while (n > 7) {
if (n & 1) {
for (int i = 0; i < 3; i++) {
place(n - 1 - 2 * i, n - 2, 2);
place(n - 8, n - 1 - 2 * i, 1);
}
for (int i = n - 4; i >= 1; i -= 2) {
place(n - 2, i, 1);
place(n - 5, i, 1);
}
for (int i = n - 10; i >= 1; i -= 2) {
place(i, n - 2, 2);
place(i, n - 5, 2);
}
} else {
for (int i = n - 1; i >= 1; i -= 2) {
place(n - 2, i, 1);
place(n - 5, i, 1);
}
for (int i = n - 7; i >= 1; i -= 2) {
place(i, n - 2, 2);
place(i, n - 5, 2);
}
}
n -= 6;
}
if (n == 3) {
place(1, 1, 1);
} else if (n == 4) {
place(1, 1, 1);
place(1, 3, 1);
} else if (n == 5) {
place(1, 1, 1);
place(1, 3, 2);
place(4, 1, 2);
place(3, 4, 1);
} else if (n == 6) {
for (int i = 1; i <= 6; i += 3) {
for (int j = 1; j <= 6; j += 2) {
place(i, j, 1);
}
}
} else if (n == 7) {
place(1, 1, 2);
place(1, 4, 1);
place(1, 6, 1);
place(3, 1, 2);
place(4, 5, 2);
place(5, 1, 1);
place(5, 3, 1);
place(6, 5, 2);
}
for (int i = 1; i < tmp; i++) {
for (int j = 1; j < tmp; j++) {
cout << mp[i][j];
}
cout << '\n';
}
}
inline void optimizeIO(void) {
ios::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
}
int main(int argc, char const *argv[]) {
optimizeIO(), cin >> t;
while (t--) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3600kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3564kb
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: 2ms
memory: 3544kb
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: 0ms
memory: 3564kb
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: 3560kb
input:
1 100
output:
#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #................................................................................................... ...#.#.#.#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##....
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed