QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#344482 | #8217. King's Dinner | SolitaryDream# | WA | 1ms | 3640kb | C++17 | 1.6kb | 2024-03-04 17:18:28 | 2024-03-04 17:18:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 105;
char a[N][N];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int Case;
cin >> Case;
while (Case--) {
int n;
cin >> n;
for (int i = 1; i <= n; ++i) {
fill(a[i] + 1, a[i] + n + 1, '.');
a[i][n + 1] = 0;
}
if (n & 1) {
for (int i = 1; i + 1 <= n; i += 3) {
for (int j = 1; j <= n; j += 2) a[i][j] = a[i + 1][j] = '#';
}
if (n % 3 == 1) {
for (int j = 1; j + 1 <= n; j += 3) a[n][j] = a[n][j + 1] = '#';
}
} else if (n % 3 == 0) {
for (int j = 1; j <= n - 2; j += 2) a[1][j] = a[2][j] = '#';
a[1][n - 1] = a[1][n] = '#';
a[3][n - 1] = a[3][n] = '#';
for (int i = 4; i <= n; i += 2) a[i][1] = a[i][2] = '#';
for (int i = 5; i <= n; i += 3)
for (int j = 4; j <= n; j += 2)
a[i][j] = a[i + 1][j] = '#';
} else {
for (int i = 1; i + 2 <= n; i += 2) {
a[i][n - 1] = a[i][n] = '#';
}
a[n - 1][n] = a[n][n] = '#';
for (int i = 1; i + 1 <= n; i += 3) {
for (int j = 1; j <= n - 2; j += 2) a[i][j] = a[i + 1][j] = '#';
}
if (n % 3 == 1) {
for (int j = 1; j + 3 <= n; j += 3) a[n][j] = a[n][j + 1] = '#';
}
}
for (int i = 1; i <= n; ++i) cout << (a[i] + 1) << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3612kb
input:
3 1 2 3
output:
. .# .# #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3640kb
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 = 16, pans = 15 (test case 9)