QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#350259#8217. King's Dinnerucup-team1198#AC ✓1ms3720kbC++202.7kb2024-03-10 16:13:192024-03-10 16:13:19

Judging History

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

  • [2024-03-10 16:13:19]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3720kb
  • [2024-03-10 16:13:19]
  • 提交

answer

#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>

using namespace std;

const int MAXN = 200;
string s[MAXN];

void vert(int i, int j) {
    s[i][j] = s[i + 1][j] = '#';
}

void hor(int i, int j) {
    s[i][j] = s[i][j + 1] = '#';
}

void col26(int i, int j) {
    hor(i, j);
    hor(i, j + 3);
}

void col36(int i, int j) {
    vert(i, j);
    vert(i, j + 2);
    vert(i, j + 4);
}

void col62(int i, int j) {
    vert(i, j);
    vert(i + 3, j);
}

void col63(int i, int j) {
    hor(i, j);
    hor(i + 2, j);
    hor(i + 4, j);
}

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        s[i].clear();
        s[i].resize(n, '.');
    }

    ++n;
    int r = n % 6;
    if (n % 6 == 1) {
        if (n > 1) {
            hor(0, 0);
            hor(2, 0);
            vert(4, 0);
            vert(0, 3);
            vert(0, 5);
            hor(3, 4);
            hor(5, 4);
            vert(4, 2);
            for (int i = 7; i < n; i += 6) {
                col36(0, i);
                col26(3, i);
                col26(5, i);

                col63(i, 0);
                col62(i, 3);
                col62(i, 5);
            }
        }
        r = 7;
    } else if (n % 6 == 2) {
        for (int i = 2; i < n; i += 6) {
            col26(0, i);
            col62(i, 0);
        }
    } else if (n % 6 == 3) {
        hor(0, 0);
        for (int i = 3; i < n; i += 6) {
            col36(0, i);
            col63(i, 0);
        }
    } else if (n % 6 == 4) {
        hor(0, 0);
        hor(2, 0);
        for (int i = 4; i < n; i += 6) {
            col26(0, i);
            col26(2, i);

            col62(i, 0);
            col62(i, 2);
        }
    } else if (n % 6 == 5) {
        hor(0, 0);
        vert(2, 0);
        hor(3, 2);
        vert(0, 3);

        for (int i = 5; i < n; i += 6) {
            col26(0, i);
            col36(2, i);

            col62(i, 0);
            col63(i, 2);
        }
    }

    for (int i = r; i < n; i += 6) {
        for (int j = r; j < n; j += 2) {
            col62(i, j);
        }
    }

    for (int i = 0; i < n - 1; ++i) {
        cout << s[i] << "\n";
    }
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int tst;
    cin >> tst;
    while (tst--) {
        solve();
        cerr << endl;
    }
    
    return 0;
}

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

详细

Test #1:

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

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

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: 1ms
memory: 3672kb

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed