QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#539300#8217. King's DinnerliyelinAC ✓2ms3656kbC++142.7kb2024-08-31 14:27:202024-08-31 14:27:21

Judging History

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

  • [2024-08-31 14:27:21]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3656kb
  • [2024-08-31 14:27:20]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define PB push_back
#define MP make_pair
#define PII pair<int, int>
#define FOR(i, l, r) for (int i = (l); i <= (r); ++i)
#define ROF(i, r, l) for (int i = (r); i >= (l); --i)
#define FI first
#define SE second
#define SZ size()
using namespace std;
const int N = 1e2 + 5;
const int mod = 998244353;
const int inf = 1e18;
int n, T;
bool mp[N][N];
void solve(int l, int r) {
    if (l > r) {
        return;
    }
    FOR (i, l, r - 3) {
        mp[i][l] = mp[i][l + 1] = 1;
        ++i;
    }
    FOR (i, l, r - 3) {
        mp[r - 1][i] = mp[r][i] = 1;
        ++i;
    }
    ROF (i, r, l + 3) {
        mp[i][r - 1] = mp[i][r] = 1;
        --i;
    }
    ROF (i, r, l + 3) {
        mp[l][i] = mp[l + 1][i] = 1;
        --i;
    }
    solve(l + 3, r - 3);
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> T;
    while (T --> 0) {
        cin >> n;
        FOR (i, 1, n) {
            FOR (j, 1, n) {
                mp[i][j] = 0;
            }
        }
        if (n & 1) {
            FOR (i, 1, n) {
                FOR (j, 1, n - 1) {
                    mp[i][j] = mp[i][j + 1] = 1;
                    j += 2;
                }
                ++i;
            }
            if (n % 6 == 3) {
                FOR (i, 1, n) {
                    FOR (j, n - 2, n) {
                        mp[i][j] = 0;
                    }
                }
                FOR (i, 1, n - 1) {
                    mp[i][n - 2] = mp[i + 1][n - 2] = mp[i][n] = mp[i + 1][n] = 1;
                    i += 2;
                }
            } else if (n % 6 == 1) {
                FOR (i, 1, n - 1) {
                    mp[i][n] = mp[i + 1][n] = 1;
                    i += 2;
                }
            }
        } else if (n % 6 == 0) {
            solve(1, n);
        } else {
            FOR (i, 1, n - 3) {
                FOR (j, 1, n - 1) {
                    mp[i][j] = mp[i][j + 1] = 1;
                    j += 2;
                }
                ++i;
            }
            FOR (i, 1, n) {
                mp[n][i] = mp[n - 1][i] = 1;
                ++i;
            }
            if (n % 6 == 4) {
                FOR (i, 1, n - 3) {
                    mp[i][n] = mp[i + 1][n] = 1;
                    i += 2;
                }
                mp[n - 1][n - 1] = 0;
                mp[n][n - 1] = mp[n][n] = 1;
            }
        }
        FOR (i, 1, n) {
            FOR (j, 1, n) {
                if (mp[i][j]) {
                    cout << '#';
                } else {
                    cout << '.';
                }
            }
            cout << '\n';
        }
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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: 2ms
memory: 3656kb

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed