QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#543201 | #8217. King's Dinner | chanmao | WA | 0ms | 3588kb | C++14 | 2.8kb | 2024-09-01 14:59:50 | 2024-09-01 14:59:50 |
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) {
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++) {
fil(i, cur + i, 1); fil(i + 4, cur + i, 1);
fil(cur + i, i, 0); fil(cur + i, i + 4, 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);
}
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= 6; j++) {
G[cur + i][cur + j] = mp[6][i][j];
}
}
}
for (int i = 1; i < n; i++) {
for (int j = 1; j < n; j++) {
cout << G[i][j];
}
cout << "\n";
}
}
int main() {
init();
int t;
cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3588kb
input:
3 1 2 3
output:
. *. *. *.* *.* ...
result:
wrong answer Token parameter [name=row of the grid] equals to "*.", doesn't correspond to pattern "[#.]+" (test case 2)