QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#585525 | #8217. King's Dinner | rotcar07 | WA | 1ms | 3572kb | C++20 | 780b | 2024-09-23 21:07:51 | 2024-09-23 21:07:52 |
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+2][l]=a[l+2][l+1]=a[l][l+3]=a[l+1][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]]);
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
3 1 2 3
output:
. ## .. ##. ... ##.
result:
ok all tests correct (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3572kb
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 = 4, pans = 3 (test case 4)