QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#449960 | #8217. King's Dinner | 2805734199h | WA | 1ms | 3664kb | C++14 | 1.4kb | 2024-06-21 21:08:56 | 2024-06-21 21:08:56 |
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 x,int y) {
if(r<=7) {
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==6) return fill(x,y,0),fill(x,y+3,0),fill(x+2,y,0),fill(x+2,y+3,0),fill(x+4,y,0),fill(x+4,y+3,0);
if(r==7) return fill(x,y,0),fill(x+3,y,1),fill(x+5,y,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;
}
for(int i=0;i<r;i+=2) {
for(int j=0;j<(i<6?r:6);j+=3) {
fill(x+i,y+j,0);
}
}
return solve(r-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,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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3664kb
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)