QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#337961 | #8217. King's Dinner | SGColin# | WA | 1ms | 3860kb | C++17 | 1.4kb | 2024-02-25 16:31:28 | 2024-02-25 16:31:28 |
Judging History
answer
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define pb push_back
#define eb emplace_back
#define all(s) (s).begin(), (s).end()
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define per(i, a, b) for (int i = (a); i >= (b); --i)
#define N 107
inline void work() {
int n; cin >> n;
vector<vector<bool>> s(n + 1, vector<bool>(n + 1, false));
if (n % 3 == 0 || n % 3 == 2) {
if (n & 1) {
rep(i, 1, n) {
if (i % 3 == 0) continue;
rep(j, 1, n) s[i][j] = (j & 1);
}
} else {
rep(i, 1, n) {
if (i & 1) s[i][n - 1] = s[i][n] = true;
if (i % 3 == 0) continue;
rep(j, 1, n - 3) s[i][j] = (j & 1);
}
}
} else if (n != 1) {
int m = n; n -= 4;
if (n & 1) {
rep(i, 1, n) {
if (i % 3 == 0) continue;
rep(j, 1, n) s[i + 2][j + 2] = (j & 1);
}
} else {
rep(i, 1, n) {
if (i & 1) s[i + 2][n + 1] = s[i + 2][n + 2] = true;
if (i % 3 == 0) continue;
rep(j, 1, n - 3) s[i + 2][j + 2] = (j & 1);
}
}
rep(i, 1, m) {
if (i % 3 != 0) s[1][i] = s[i][m] = true;
if (i % 3 != 2) s[i][1] = true;
}
s[m][m - 1] = true;
rep(i, 3, m - 3) if (i & 1) s[m - 1][i] = s[m][i] = true;
n = m;
}
rep(i, 1, n) {
rep(j, 1, n) putchar(s[i][j] ? '#' : '.');
puts("");
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int t; cin >> t;
while (t--) work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
3 1 2 3
output:
. ## .. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3860kb
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)