QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#543257 | #8217. King's Dinner | chanmao | WA | 5ms | 3872kb | C++14 | 3.1kb | 2024-09-01 15:22:12 | 2024-09-01 15:22:13 |
Judging History
answer
#include <iostream>
using namespace std;
char mp[8][8][8];
char G[105][105];
string _1[2] = { "",
" ." };
string _2[3] = { "",
" ..",
" .." };
string _3[4] = { "",
" #..",
" #..",
" ..." };
string _4[5] = { "",
" #.#.",
" #.#.",
" ....",
" ...." };
string _5[6] = { "",
" ##.#.",
" ...#.",
" #....",
" #.##.",
" ....." };
string _6[7] = { "",
" ##.##.",
" ......",
" ##.##.",
" ......",
" ##.##.",
" ......" };
string _7[8] = { "",
" ##.#.#.",
" ...#.#.",
" ##.....",
" ....##.",
" #.#....",
" #.#.##.",
" ......." };
inline void init() {
int len = 1;
len = 1; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _1[i][j]; }
len = 2; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _2[i][j]; }
len = 3; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _3[i][j]; }
len = 4; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _4[i][j]; }
len = 5; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _5[i][j]; }
len = 6; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _6[i][j]; }
len = 7; for (int i = 1; i <= len; i++) for (int j = 1; j <= len; j++) { mp[len][i][j] = _7[i][j]; }
}
inline void fil(int i, int j, bool d) {
cout << i << " " << j << " " << d << endl;
if (d) {
G[i][j] = '#'; G[i][j + 1] = '#'; G[i][j + 2] = '.';
G[i + 1][j] = '.'; G[i + 1][j + 1] = '.'; G[i + 1][j + 2] = '.';
} else {
G[i][j] = '#'; G[i][j + 1] = '.';
G[i + 1][j] = '#'; G[i + 1][j + 1] = '.';
G[i + 2][j] = '.'; G[i + 2][j + 1] = '.';
}
}
inline void solve() {
int n;
cin >> n; n++;
if (n <= 7) {
for (int i = 1; i < n; i++) {
for (int j = 1; j < n; j++) {
cout << mp[n][i][j];
}
cout << "\n";
}
return;
}
int cur = n % 6;
if (n <= 1) n += 6;
for (int i = 1; i <= cur; i++) {
for (int j = 1; j <= cur; j++) {
G[i][j] = mp[cur][i][j];
}
}
while (cur < n) {
for (int i = 1; i + 4 - 1 <= cur; i += 4) {
fil(i, cur + i, 1); fil(i, cur + i + 3, 1);
fil(cur + i, i, 0); fil(cur + i + 3, i, 0);
}
if (cur % 2) {
fil(cur - 2, cur + 1, 0); fil(cur - 2, cur + 3, 0); fil(cur - 2, cur + 5, 0);
fil(cur + 1, cur - 2, 1); fil(cur + 3, cur - 2, 1); fil(cur + 5, cur - 2, 1);
} else {
fil(cur - 1, cur + 1, 1); fil(cur - 1, cur + 4, 1);
fil(cur + 1, cur - 1, 0); fil(cur + 4, cur - 1, 0);
}
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= 6; j++) {
G[cur + i][cur + j] = mp[6][i][j];
}
}
cur += 6;
}
for (int i = 1; i < n; i++) {
for (int j = 1; j < n; j++) {
cout << G[i][j];
}
cout << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
// fil(1, 1, 1) ;
// for (int i = 1; i <= 3; i++) {
// for (int j = 1; j <= 3; j++) {
// cout << G[i][j];
// }
// cout << "\n";
// }
init();
int t;
cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 3872kb
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:
. #. #. #.# #.# ... ##.# ...# #... #.## ##.## ..... ##.## ..... ##.## ##.#.# ...#.# ##.... ....## #.#... #.#.## 1 3 1 1 6 1 3 1 0 6 1 0 ..##.## ....... #.##.## #...... ..##.## #...... #.##.## 1 4 0 1 6 0 1 8 0 4 1 1 6 1 1 8 1 1 #..#.#.# #..#.#.# ........ ##.##.## ........ ##.##.## ........ ##.##.## ...
result:
wrong answer Token parameter [name=row of the grid] equals to "1", doesn't correspond to pattern "[#.]+" (test case 7)