QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#539287 | #8217. King's Dinner | liyelin | WA | 1ms | 3652kb | C++14 | 2.7kb | 2024-08-31 14:25:34 | 2024-08-31 14:25:34 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define PB push_back
#define MP make_pair
#define PII pair<int, int>
#define FOR(i, l, r) for (int i = (l); i <= (r); ++i)
#define ROF(i, r, l) for (int i = (r); i >= (l); --i)
#define FI first
#define SE second
#define SZ size()
using namespace std;
const int N = 1e2 + 5;
const int mod = 998244353;
const int inf = 1e18;
int n, T;
bool mp[N][N];
void solve(int l, int r) {
if (l > r) {
return;
}
FOR (i, l, r - 3) {
mp[i][l] = mp[i][l + 1] = 1;
++i;
}
FOR (i, l, r - 3) {
mp[r - 1][i] = mp[r][i] = 1;
++i;
}
ROF (i, r, l + 3) {
mp[i][r - 1] = mp[i][r + 1] = 1;
--i;
}
ROF (i, r, l + 3) {
mp[l + 1][i] = mp[l + 2][i] = 1;
--i;
}
solve(l + 3, r - 3);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> T;
while (T --> 0) {
cin >> n;
FOR (i, 1, n) {
FOR (j, 1, n) {
mp[i][j] = 0;
}
}
if (n & 1) {
FOR (i, 1, n) {
FOR (j, 1, n - 1) {
mp[i][j] = mp[i][j + 1] = 1;
j += 2;
}
++i;
}
if (n % 6 == 3) {
FOR (i, 1, n) {
FOR (j, n - 2, n) {
mp[i][j] = 0;
}
}
FOR (i, 1, n - 1) {
mp[i][n - 2] = mp[i + 1][n - 2] = mp[i][n] = mp[i + 1][n] = 1;
i += 2;
}
} else if (n % 6 == 1) {
FOR (i, 1, n - 1) {
mp[i][n] = mp[i + 1][n] = 1;
i += 2;
}
}
} else if (n % 6 == 0) {
solve(1, n);
} else {
FOR (i, 1, n - 3) {
FOR (j, 1, n - 1) {
mp[i][j] = mp[i][j + 1] = 1;
j += 2;
}
++i;
}
FOR (i, 1, n) {
mp[n][i] = mp[n - 1][i] = 1;
++i;
}
if (n % 6 == 4) {
FOR (i, 1, n - 3) {
mp[i][n] = mp[i + 1][n] = 1;
i += 2;
}
mp[n - 1][n - 1] = 0;
mp[n][n - 1] = mp[n][n] = 1;
}
}
FOR (i, 1, n) {
FOR (j, 1, n) {
if (mp[i][j]) {
cout << '#';
} else {
cout << '.';
}
}
cout << '\n';
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3652kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
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:
wrong answer grid contains two dominoes that are adjacent (test case 6)