QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#443671 | #8217. King's Dinner | _l_l_ | WA | 1ms | 3760kb | C++14 | 1.2kb | 2024-06-15 16:16:28 | 2024-06-15 16:16:30 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 105;
char str[MAXN][MAXN];
int main() {
int t; scanf("%d", &t); while (t--) {
int n; scanf("%d", &n);
if (n == 1) puts(".");
else if (n == 4) puts("##.#\n...#\n#...\n#.##");
else {
int a = (n + 1) / 3, b = (n + 1) / 2;
int ans = 0;
for (int i = 0; 2 * i <= n + 1; i++) {
ans = max(ans, i * a + (n + 1 - 2 * i) / 3 * b);
}
// printf("%d\n", ans);
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;
for (int i = 0; 2 * i <= n + 1; i++) {
if (ans == i * a + (n + 1 - 2 * i) / 3 * b) {
int j = (n + 1 - 2 * i) / 3;
for (int k = 1; k <= i; k++) {
for (int f = 1; f <= a; f++) str[2 * k - 1][3 * f - 2] = '#';
for (int f = 1; f <= a; f++) str[2 * k - 1][3 * f - 1] = '#';
}
for (int k = 1; k <= j; k++) {
for (int f = 1; f <= b; f++) str[2 * i + 3 * k - 2][2 * f - 1] = '#';
for (int f = 1; f <= b; f++) str[2 * i + 3 * k - 1][2 * f - 1] = '#';
}
break;
}
}
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: 3748kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3760kb
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 jury has the better answer: jans = 8, pans = 7 (test case 6)