QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#512645#8217. King's DinnerHunsterAC ✓1ms3724kbC++202.4kb2024-08-10 15:12:342024-08-10 15:12:34

Judging History

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

  • [2024-08-10 15:12:34]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3724kb
  • [2024-08-10 15:12:34]
  • 提交

answer

#include <bits/stdc++.h>

constexpr int N = 102;
int a[N][N];
void work(int n) {
    if (n - 6 >= 2) {
        if (n - 6 & 1) {
            for (int i = 1; i <= n - 6 - 3; i += 2)
                a[i][n - 1] = a[i][n - 2] = a[i][n - 4] = a[i][n - 5] = 1;
            a[n - 6 - 1][n - 5] = a[n - 6 - 2][n - 5] = 1;
            a[n - 6 - 1][n - 3] = a[n - 6 - 2][n - 3] = 1;
            a[n - 6 - 1][n - 1] = a[n - 6 - 2][n - 1] = 1;
        } 
        else {
            for (int i = 1; i <= n - 6; i += 2)
                a[i][n - 1] = a[i][n - 2] = a[i][n - 4] = a[i][n - 5] = 1;
        }
        if (n & 1) {
            for (int i = 1; i <= n - 3; i += 2)
                a[n - 1][i] = a[n - 2][i] = a[n - 4][i] = a[n - 5][i] = 1;
            a[n - 5][n - 1] = a[n - 5][n - 2] = 1;
            a[n - 3][n - 1] = a[n - 3][n - 2] = 1;
            a[n - 1][n - 1] = a[n - 1][n - 2] = 1;
        }
        else {
            for (int i = 1; i <= n; i += 2)
                a[n - 1][i] = a[n - 2][i] = a[n - 4][i] = a[n - 5][i] = 1;
        }
        work(n - 6);
        return;
    }
    if (n == 3) {
        a[1][1] = a[1][2] = 1;
    }
    if (n == 4) {
        a[1][1] = a[1][2] = 1;
        a[3][1] = a[3][2] = 1;
    }
    if (n == 5) {
        a[1][1] = a[2][1] = 1;
        a[4][1] = a[4][2] = 1;
        a[4][4] = a[3][4] = 1;
        a[1][4] = a[1][3] = 1;
    }
    if (n == 6) {
        /*
        ##.##
        .....
        ##.##
        .....
        ##.##
        */
        a[1][1] = a[1][2] = a[1][4] = a[1][5] = 1;
        a[3][1] = a[3][2] = a[3][4] = a[3][5] = 1;
        a[5][1] = a[5][2] = a[5][4] = a[5][5] = 1;
    }
    if (n == 7) {
        /*
        ##.#.#
        ...#.#
        ##....
        ....##
        #.#...
        #.#.##
        */
        a[1][1] = a[1][2] = 1;
        a[1][4] = a[2][4] = 1;
        a[1][6] = a[2][6] = 1;
        a[3][1] = a[3][2] = 1;
        a[4][5] = a[4][6] = 1;
        a[5][1] = a[6][1] = 1;
        a[5][3] = a[6][3] = 1;
        a[6][5] = a[6][6] = 1;
    }
}

int main() {
    int T;
    std::cin >> T;
    while (T--) {
        int n;
        std::cin >> n;
        std::fill_n((int*)a, N * N, 0);
        work(n + 1);
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) putchar(a[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: 3648kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3600kb

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: 0ms
memory: 3584kb

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: 3652kb

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: 3724kb

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed