QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#443866 | #8217. King's Dinner | _l_l_ | WA | 0ms | 3820kb | C++14 | 1.6kb | 2024-06-15 16:42:36 | 2024-06-15 16:42:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
char str[MAXN][MAXN];
void draw(int dx, int dy, int n) {
if (n < 2) return;
if (n == 2) return str[dx][dy] = str[dx][dy + 1] = '#', void();
if (n == 3) return str[dx][dy] = str[dx][dy + 1] = str[dx + 2][dy] = str[dx + 2][dy + 1] = '#', void();
if (n % 2 == 0) {
for (int i = 1; i < n / 2; i++) {
str[dx][dy + 2 * i - 2] = str[dx + 1][dy + 2 * i - 2] = '#';
str[dx + 2 * i + 1][dy] = str[dx + 2 * i + 1][dy + 1] = '#';
str[dx + n - 1][dy + 2 * i + 1] = str[dx + n - 2][dy + 2 * i + 1] = '#';
str[dx + 2 * i - 2][dy + n - 1] = str[dx + 2 * i - 2][dy + n - 2] = '#';
}
draw(dx + 3, dy + 3, n - 6);
}
else if (n % 3 == 1) {
for (int i = 1; i <= n / 3; i++) {
str[dx][dy + 3 * i - 3] = str[dx][dy + 3 * i - 2] = '#';
str[dx + 3 * i - 1][dy] = str[dx + 3 * i][dy] = '#';
str[dx + 3 * i - 3][dy + n - 1] = str[dx + 3 * i - 2][dy + n - 1] = '#';
str[dx + n - 1][dy + 3 * i - 1] = str[dx + n - 1][dy + 3 * i] = '#';
}
draw(dx + 2, dy + 2, n - 4);
}
else if (n % 3 == 2) {
for (int i = 1; i <= n / 2 + 1; i++) for (int j = 1; j <= n / 3 + 1; j++) {
str[dx + i * 2 - 2][dy + j * 3 - 3] = str[dx + i * 2 - 2][dy + j * 3 - 2] = '#';
}
}
else {
for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) str[dx + i - 1][dy + j - 1] = '?';
}
}
int main() {
int t; scanf("%d", &t); while (t--) {
int n; scanf("%d", &n);
for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) str[i][j] = '.';
for (int i = 1; i <= n; i++) str[i][n + 1] = 0;
draw(1, 1, n);
for (int i = 1; i <= n; i++) puts(str[i] + 1);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3820kb
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:
wrong answer Token parameter [name=row of the grid] equals to "?????????", doesn't correspond to pattern "[#.]+" (test case 9)