QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#449979 | #8217. King's Dinner | 2805734199h | AC ✓ | 3ms | 3664kb | C++14 | 1.7kb | 2024-06-21 21:31:44 | 2024-06-21 21:31:44 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int n,tot,a[105][105];
void fill(int r,int c,int flg) {
++tot;
for(int i=r;i<r+2+flg;++i) {
for(int j=c;j<c+3-flg;++j) {
a[i][j]=tot;
}
}
}
void solve(int r,int c,int x,int y) {
if(!r||!c) return;
if(r==6) {
if(c%6==0||c%6==1||c%6==3) return fill(x,y,0),fill(x+2,y,0),fill(x+4,y,0),solve(r,c-3,x,y+3);
else return fill(x,y,1),fill(x+3,y,1),solve(r,c-2,x,y+2);
}
if(c==6) {
if(r%6==0||r%6==1||r%6==3) return fill(x,y,1),fill(x,y+2,1),fill(x,y+4,1),solve(r-3,c,x+3,y);
else return fill(x,y,0),fill(x,y+3,0),solve(r-2,c,x+2,y);
}
if(r<=7) {
assert(r==c);
if(r<=2) return;
if(r==3) return fill(x,y,0);
if(r==4) return fill(x,y,0),fill(x+2,y,0);
if(r==5) return fill(x,y,0),fill(x,y+3,1),fill(x+2,y,1),fill(x+3,y+2,0);
if(r==7) return fill(x,y,0),fill(x,y+3,1),fill(x,y+5,1),fill(x+2,y,0),fill(x+3,y+4,0),fill(x+4,y,1),fill(x+4,y+2,1),fill(x+5,y+4,0);
return;
}
return solve(6,c,x,y),solve(r-6,6,x+6,y),solve(r-6,c-6,x+6,y+6);
}
void work() {
cin>>n; ++n;
tot=0;
for(int i=1;i<=n;++i) {
for(int j=1;j<=n;++j) {
a[i][j]=0;
}
}
solve(n,n,1,1);
for(int i=1;i<n;++i) {
for(int j=1;j<n;++j) {
if(a[i][j]&&a[i][j]==a[i][j+1]&&a[i][j]==a[i+1][j]&&a[i][j]==a[i+1][j+1]) {
cout<<'#';
} else {
cout<<'.';
}
}
cout<<'\n';
}
}
int main() {
int T;
cin>>T;
while(T--) work();
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 1ms
memory: 3560kb
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: 3ms
memory: 3644kb
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: 3664kb
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: 3648kb
input:
1 100
output:
#.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.## #................................................................................................... ..##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##.##....
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed