QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#368792#8217. King's Dinnerucup-team3215#WA 1ms3832kbC++201.1kb2024-03-27 16:30:472024-03-27 16:30:50

Judging History

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

  • [2024-03-27 16:30:50]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3832kb
  • [2024-03-27 16:30:47]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<vector<char>> res(n, vector<char>(n, '.'));
    if (n % 3 == 0) {
        for (int i = 0; i < n; i += 2) {
            for (int j = 0; j + 3 < n; j += 3) {
                res[i][j] = res[i][j + 1] = '#';
            }
        }
        for (int i = 0; i + 1 < n; i += 3) {
            res[i][n - 1] = res[i + 1][n - 1] = '#';
            res[i][n - 3] = res[i + 1][n - 3] = '#';
        }
    } else {
        for (int i = 0; i < n; i += 2) {
            for (int j = 0; j + 1 < n; j += 3) {
                res[i][j] = res[i][j + 1] = '#';
            }
        }
        if (n % 3 == 1) {
            for (int i = 0; i + 1 < n; i += 3) {
                res[i].back() = res[i + 1].back() = '#';
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            cout << res[i][j];
        }
        cout << "\n";
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--)solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3832kb

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 = 4, pans = 3 (test case 4)