QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#442397 | #8217. King's Dinner | D_F_S | AC ✓ | 1ms | 3876kb | C++14 | 1.0kb | 2024-06-15 11:37:25 | 2024-06-15 11:37:25 |
Judging History
answer
#include<bits/stdc++.h>
int T,n,a[105][105];
int main()
{
scanf("%d",&T); for(int i=1,u,v,x,y;i<=T;++i)
{
scanf("%d",&n); if(n==1) {puts("."); continue; } !(u=n%6)&&(u+=6);
for(v=u,x=1;x<=n-u;x+=3) for(y=1;y<=n-u;y+=2) a[x][y]=a[x+1][y]=i;
if(v==3||v==6) {for(x=1;x<=n-u;x+=3) a[n-v+1][x]=a[n-v+1][x+1]=a[x][n-v+1]=a[x+1][n-v+1]=i; v-=2; }
if(v>=3) {for(x=1;x<=n-u;x+=2) a[n-v+1][x]=a[n-v+2][x]=a[x][n-v+1]=a[x][n-v+2]=i; v-=3; }
if(v==2) for(x=1;x<=n-u;x+=2) a[n-1][x]=a[n][x]=a[x][n-1]=a[x][n]=i;
if(v==1) for(x=1;x<=n-u;x+=3) a[n][x]=a[n][x+1]=a[x][n]=a[x+1][n]=i;
if(u==6) a[n-5][n-5]=a[n-5][n-4]=a[n-5][n-2]=a[n-4][n-2]=a[n-5][n]=a[n-4][n]=a[n-3][n-5]=a[n-3][n-4]=a[n-2][n-1]=a[n-2][n]=a[n-1][n-5]=a[n][n-5]=a[n-1][n-3]=a[n][n-3]=a[n][n-1]=a[n][n]=i;
else if(u==4) a[n-3][n-3]=a[n-3][n-2]=a[n-3][n]=a[n-2][n]=a[n-1][n-3]=a[n][n-3]=a[n][n-1]=a[n][n]=i;
else for(x=n-u+1;x<n;x+=3) for(y=n-u+1;y<=n;y+=2) a[x][y]=a[x+1][y]=i;
for(x=1;x<=n;++x,putchar('\n')) for(y=1;y<=n;++y) putchar(a[x][y]==i?'#':'.');
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
input:
3 1 2 3
output:
. #. #. #.# #.# ...
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3604kb
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:
ok all tests correct (50 test cases)
Test #3:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
39 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ................................................... #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...........................................
result:
ok all tests correct (39 test cases)
Test #4:
score: 0
Accepted
time: 1ms
memory: 3676kb
input:
11 90 91 92 93 94 95 96 97 98 99 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....# ......................................................................................##.. #.#.#.#.#.#.#.#.#.#.#.#.#.#...
result:
ok all tests correct (11 test cases)
Test #5:
score: 0
Accepted
time: 0ms
memory: 3820kb
input:
1 100
output:
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.##.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....# ................................................................................................##...
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed