QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#585539 | #8217. King's Dinner | rotcar07 | AC ✓ | 1ms | 3640kb | C++20 | 802b | 2024-09-23 21:10:11 | 2024-09-23 21:10:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
bool a[105][105];
int main(){
int t;cin>>t;
while(t--){
int n;cin>>n;
memset(a,0,sizeof a);n++;
if(n&1){
int l=1,sz=n,r=n;
while(sz>6){
for(int i=l+3;i<=r;i+=2) a[l][i]=a[l+1][i]=a[i][r-2]=a[i][r-1]=1;
for(int i=l;i<=r-3;i+=2) a[r-1][i]=a[r-2][i]=a[i][l+1]=a[i][l]=1;
sz-=6;l+=3,r-=3;
}
if(sz==3) a[l][l]=a[l][l+1]=1;
else if(sz==5)a[l][l]=a[l][l+1]=a[l][l+3]=a[l+1][l+3]=a[l+3][l]=a[l+2][l]=a[l+3][l+2]=a[l+3][l+3]=1;
}
else{
int r=n%6;
for(int i=1;i+r<=n;i+=3)
for(int j=1;j<=n;j+=2) a[i][j]=a[i+1][j]=1;
for(int i=n;i>n-r;i-=2)
for(int j=1;j+2<=n;j+=3) a[i-1][j]=a[i-1][j+1]=1;
}
for(int i=1;i<n;i++,putchar('\n'))
for(int j=1;j<n;j++) putchar(".#"[a[i][j]]);
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
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: 3640kb
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: 3572kb
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: 3628kb
input:
1 100
output:
##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ##...................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed