QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#512687 | #8217. King's Dinner | JohnAlfnov | AC ✓ | 1ms | 3796kb | C++14 | 2.2kb | 2024-08-10 15:23:45 | 2024-08-10 15:23:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int ans[105][105];
vector<pair<pair<int,int>,int>>vc[15];
int main(){
vc[3].emplace_back(make_pair(1,1),0);
vc[4].emplace_back(make_pair(1,1),0);
vc[4].emplace_back(make_pair(3,1),0);
vc[5].emplace_back(make_pair(1,1),0);
vc[5].emplace_back(make_pair(1,4),1);
vc[5].emplace_back(make_pair(3,1),1);
vc[5].emplace_back(make_pair(4,3),0);
vc[6].emplace_back(make_pair(1,1),0);
vc[6].emplace_back(make_pair(1,4),0);
vc[6].emplace_back(make_pair(3,1),0);
vc[6].emplace_back(make_pair(3,4),0);
vc[6].emplace_back(make_pair(5,1),0);
vc[6].emplace_back(make_pair(5,4),0);
vc[7].emplace_back(make_pair(1,1),0);
vc[7].emplace_back(make_pair(1,4),1);
vc[7].emplace_back(make_pair(1,6),1);
vc[7].emplace_back(make_pair(3,1),0);
vc[7].emplace_back(make_pair(4,5),0);
vc[7].emplace_back(make_pair(5,1),1);
vc[7].emplace_back(make_pair(5,3),1);
vc[7].emplace_back(make_pair(6,5),0);
int T;
scanf("%d",&T);
while(T--){
int n;
scanf("%d",&n);int N=n;++n;
vector<pair<pair<int,int>,int>>vv;
for(int i=1;i<=N;++i)for(int j=1;j<=N;++j)
ans[i][j]=0;
while(n>7){
int nn=n-6;
while(nn>3){
vv.emplace_back(make_pair(n-5,nn-1),1);
vv.emplace_back(make_pair(n-2,nn-1),1);
nn-=2;
}
if(nn==3){
vv.emplace_back(make_pair(n-5,nn-2),0);
vv.emplace_back(make_pair(n-3,nn-2),0);
vv.emplace_back(make_pair(n-1,nn-2),0);
}else{
vv.emplace_back(make_pair(n-5,nn-1),1);
vv.emplace_back(make_pair(n-2,nn-1),1);
}
nn=n;
while(nn>3){
vv.emplace_back(make_pair(nn-1,n-5),0);
vv.emplace_back(make_pair(nn-1,n-2),0);
nn-=2;
}
if(nn==3){
vv.emplace_back(make_pair(nn-2,n-5),1);
vv.emplace_back(make_pair(nn-2,n-3),1);
vv.emplace_back(make_pair(nn-2,n-1),1);
}else{
vv.emplace_back(make_pair(nn-1,n-5),0);
vv.emplace_back(make_pair(nn-1,n-2),0);
}
n-=6;
}
for(auto pii:vc[n])vv.emplace_back(pii);
for(auto pii:vv){
auto pi=pii.first;
ans[pi.first][pi.second]=1;
if(pii.second)ans[pi.first+1][pi.second]=1;
else ans[pi.first][pi.second+1]=1;
}
for(int i=1;i<=N;++i){
for(int j=1;j<=N;++j)putchar(ans[i][j]?'#':'.');
putchar('\n');
}
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3664kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: 0
Accepted
time: 0ms
memory: 3700kb
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: 3796kb
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: 3764kb
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: 3796kb
input:
1 100
output:
##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# ...#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #....................................................................................................
result:
ok all tests correct (1 test case)
Extra Test:
score: 0
Extra Test Passed