QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#514104 | #8217. King's Dinner | wallace114514 | WA | 2ms | 3736kb | C++14 | 1.6kb | 2024-08-10 21:52:37 | 2024-08-10 21:52:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int t,n;
char a[N][N];
char m[N][N][N]={
{{'.'}},{{'#','.'},{'#','.'}},{{'#','.','#'},{'#','.','#'},{'.','.','.'}},
{{'#','.','#','#'},{'#','.','.','.'},{'.','.','.','#'},{'#','#','.','#'}},
{{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'},{'.','.','.','.','.'},{'#','#','.','#','#'}},
{{'#','#','.','#','#','.'},{'.','.','.','.','.','.'},{'#','#','.','#','#','.'},{'.','.','.','.','.','.'},{'#','#','.','#','#','.'},{'.','.','.','.','.','.'}},
{{'#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#'},
{'.','.','.','.','.','.','.'},
{'#','.','#','.','#','.','#'},
{'#','.','#','.','#','.','#'},
{'.','.','.','.','.','.','.'},
{'#','#','.','#','#','.','.'}
}
};
void dfs(int x) {
if(x>7) {
if(x%2==0) {
for(int i=1;i<=x-6;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
for(int i=1;i<=x;i+=2) a[i+1][x-4]=a[i+1][x-3]=a[i+1][x-1]=a[i+1][x]='#';
}else {
for(int i=1;i<=x-9;i+=2) a[x-4][i]=a[x-3][i]=a[x-1][i]=a[x][i]='#';
a[x][x-8]=a[x][x-7]=a[x-2][x-8]=a[x-2][x-7]=a[x-4][x-8]=a[x-4][x-7]='#';
for(int i=1;i<=x-3;i+=2) a[i+1][x-4]=a[i+1][x-3]=a[i+1][x-1]=a[i+1][x]='#';
a[x][x]=a[x-1][x]=a[x][x-2]=a[x-1][x-2]=a[x][x-4]=a[x-1][x-4]='#';
}
dfs(x-6);
return;
}
for(int i=1;i<=x;i++) {
for(int j=1;j<=x;j++) {
a[i][j]=m[x-1][i-1][j-1];
}
}
}
int main(){
cin>>t;
while(t--) {
cin>>n;
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) {
a[i][j]='.';
}
}
dfs(n);
for(int i=1;i<=n;i++) {
for(int j=1;j<=n;j++) cout<<a[i][j];
cout<<endl;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3736kb
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 = 6 (test case 6)