QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449963#8217. King's Dinner2805734199hWA 1ms3712kbC++141.4kb2024-06-21 21:12:472024-06-21 21:12:47

Judging History

你现在查看的是最新测评结果

  • [2024-06-21 21:12:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2024-06-21 21:12:47]
  • 提交

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,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;
    }
    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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3712kb

input:

3
1
2
3

output:

.
##
..
##.
...
##.

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3608kb

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 grid has a singular #, not a domino, in it (test case 7)