QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#512661 | #8217. King's Dinner | Alex_wcq | WA | 0ms | 3796kb | C++14 | 1.2kb | 2024-08-10 15:16:03 | 2024-08-10 15:16:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
char f[110][110]; int c[]={0,0,2,4,8,12,16},P[][20][2]={{},{},{{1,1},{1,2}},{{1,1},{1,2},{3,1},{3,2}},{{1,1},{1,2},{1,4},{2,4},{3,1},{4,1},{4,3},{4,4}},{{1,1},{1,2},{1,4},{1,5},{3,1},{3,2},{3,4},{3,5},{5,1},{5,2},{5,4},{5,5}},{{1,1},{1,2},{1,4},{1,6},{2,4},{2,6},{3,1},{3,2},{4,5},{4,6},{5,1},{5,3},{6,1},{6,3},{6,5},{6,6}}};
int main(){
int T; scanf("%d",&T);
while(T--){
int n; scanf("%d",&n);
for(int i=1;i<=n;++i) for(int j=1;j<=n;++j) f[i][j]='.';
for(int i=n;i>=0;i-=6){
if(i<=6) for(int j=0;j<c[i];++j) f[P[i][j][0]][P[i][j][1]]='#';
else if(n%2){
for(int i=1;i<=n-6;i+=2) f[n-4][i]=f[n-3][i]=f[n-1][i]=f[n][i]='#';
for(int i=1;i<=n;i+=2) f[i][n-4]=f[i][n-3]=f[i][n-1]=f[i][n]='#';
}
else{
for(int i=1;i<=n-8;i+=2) f[n-4][i]=f[n-3][i]=f[n-1][i]=f[n][i]='#';
f[n-4][n-7]=f[n-4][n-6]=f[n-2][n-7]=f[n-2][n-6]=f[n][n-7]=f[n][n-6]='#';
for(int i=1;i<=n-2;i+=2) f[i][n-4]=f[i][n-3]=f[i][n-1]=f[i][n]='#';
f[n-1][n-4]=f[n][n-4]=f[n-1][n-2]=f[n][n-2]=f[n-1][n]=f[n][n]='#';
}
}
for(int i=1;i<=n;++i) printf("%s\n",f[i]+1);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3792kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3796kb
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 = 32, pans = 22 (test case 13)