QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321964#8217. King's DinnerKKT89WA 1ms3868kbC++173.9kb2024-02-05 23:36:252024-02-05 23:36:25

Judging History

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

  • [2024-02-05 23:36:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3868kb
  • [2024-02-05 23:36:25]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}
inline double time() {
    return static_cast<long double>(chrono::duration_cast<chrono::nanoseconds>(chrono::steady_clock::now().time_since_epoch()).count()) * 1e-9;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int q; cin >> q;
    while (q--) {
        int n; cin >> n;
        vector<vector<char>> v(n, vector<char>(n, '.'));
        if (n%6 == 1) {
            for (int i = 0; i < n; i += 2) {
                for (int j = 0; j+1 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
            for (int i = 0; i+1 < n; i += 3) {
                v[i][n-1] = v[i+1][n-1] = '#';
            }
        }
        else if (n%6 == 2) {
            for (int i = 0; i+3 < n; i += 2) {
                for (int j = 0; j+1 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
            for (int i = 0; i < n; i += 2) {
                v[n-2][i] = v[n-1][i] = '#';
            }
        }
        else if (n%6 == 3) {
            for (int i = 0; i < n; i += 2) {
                for (int j = 0; j+3 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
            for (int i = 0; i+1 < n; i += 3) {
                v[i][n-3] = v[i+1][n-3] = '#';
                v[i][n-1] = v[i+1][n-1] = '#';
            }
        }
        else if (n%6 == 4) {
            for (int i = 0; i+2 < n; i += 2) {
                for (int j = 0; j+1 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
            for (int j = 0; j < n-4; j += 2) {
                v[n-2][j] = v[n-1][j] = '#';
            }
            for (int i = 0; i+4 < n; i += 3) {
                v[i][n-1] = v[i+1][n-1] = '#';
            }
            v[n-4][n-4] = v[n-4][n-3] = '#';
            v[n-4][n-1] = v[n-3][n-1] = '#';
            v[n-1][n-1] = v[n-1][n-2] = '#';
            v[n-1][n-4] = v[n-2][n-4] = '#';
        }
        else if (n%6 == 5) {
            for (int i = 0; i < n; i += 2) {
                for (int j = 0; j+1 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
        }
        else {
            for (int i = 0; i+2 < n; i += 2) {
                for (int j = 0; j+6 < n; j += 3) {
                    v[i][j] = v[i][j+1] = '#';
                }
            }
            for (int j = 0; j < n - 6; j += 2) {
                v[n-2][j] = v[n-1][j] = '#';
            }
            for (int i = 0; i+6 < n; i += 3) {
                v[i][n-6] = v[i+1][n-6] = '#';
                v[i][n-4] = v[i+1][n-4] = '#';
                v[i][n-2] = v[i+1][n-2] = '#';
            }
            v[n-6][n-6] = v[n-5][n-6] = '#';
            v[n-6][n-4] = v[n-5][n-4] = '#';
            v[n-6][n-2] = v[n-6][n-1] = '#';
            v[n-4][n-2] = v[n-4][n-1] = '#';
            v[n-3][n-6] = v[n-3][n-5] = '#';
            v[n-1][n-6] = v[n-1][n-5] = '#';
            v[n-1][n-3] = v[n-2][n-3] = '#';
            v[n-1][n-1] = v[n-2][n-1] = '#';

            for (int i = 0; i < n - 6; ++i) {
                for (int j = 0; j < n; ++j) {
                    v[i][j] = '.';
                }
            }
            for (int i = 0; i+2 < n-6; i += 3) {
                for (int j = 0; j+1 < n; j += 2) {
                    v[i][j] = v[i+1][j] = '#';
                }
            }
        }

        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                cout << v[i][j];
            }
            cout << '\n';
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 = 28, pans = 27 (test case 12)