QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#334835#8217. King's Dinnerucup-team1209#WA 1ms3636kbC++202.6kb2024-02-22 14:22:252024-02-22 14:22:25

Judging History

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

  • [2024-02-22 14:22:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3636kb
  • [2024-02-22 14:22:25]
  • 提交

answer

#include <bits/stdc++.h>
#define cs const
#define pb push_back
using namespace std;

cs int N = 105;

int mp[N][N], n, T; 
void paint(int a, int b, int c, int d) {
    // cerr << a << ' ' << b << ' ' << c  << ' ' << d << endl;
    assert((c - a) * (d - b) == 2); 
    assert(a < c && b < d);
    mp[a][b] = mp[c - 1][d - 1] = 1; 
}
void work(int n) {
    for(int i = 1; i < n; i += 2) 
        for(int j = 1; j < n; j += 3)   
            paint(i, j, i + 1, j + 2);
}
void Paint(int a, int b, int c, int d) {
    paint(a, b, c, d);
    paint(b, a, d, c);
}
void work5(int n) {
    work(n - 5);
    for(int i = 1; i < n - 5; i += 6) {
        Paint(n - 4, i, n - 2, i + 1);
        Paint(n - 4, i + 2, n - 2, i + 3);
        Paint(n - 4, i + 4, n - 2, i + 5);
        Paint(n - 1, i, n, i + 2);
        Paint(n - 1, i + 3, n, i + 5);
    }
    paint(n - 4, n - 4, n - 3, n - 2);
    paint(n - 2, n - 4, n, n - 3);
    paint(n - 1, n - 2, n, n);
    paint(n - 4, n - 1, n - 2, n);
}
void Main() {
    cin >> n; ++ n;
    // cout << "FFFFFFFFFFFFFFFF " << n << endl;
    for(int i = 0; i <= n; i++)
    for(int j = 0; j <= n; j++) mp[i][j] = 0; 
    if(n % 6 == 0) {
        work(n);
    }
    if(n % 6 == 2) {
        work(n - 2);
        for(int i = 1; i < n - 2; i += 3)
            paint(n - 1, i, n, i + 2);
        for(int i = 1; i < n - 2; i += 3)
            paint(i, n - 1, i + 2, n);
    }
    if(n % 6 == 3) {
        work(n - 3);
        for(int i = 1; i < n - 3; i += 2)
            paint(n - 2, i, n, i + 1);
        for(int i = 1; i < n - 1; i += 2)
            paint(i, n - 2, i + 1, n);
    }
    if(n % 6 == 4) {
        work(n - 4);
        for(int i = 1; i < n - 4; i += 3)
            paint(n - 3, i, n - 2, i + 2);
        for(int i = 1; i < n - 4; i += 3)
            paint(n - 1, i, n, i + 2);
        for(int i = 1; i < n - 1; i += 3)
            paint(i, n - 3, i + 2, n - 2);
        for(int i = 1; i < n - 1; i += 3)
            paint(i, n - 1, i + 2, n);
    }
    if(n % 6 == 5) {
        work5(n);
    }
    if(n % 6 == 1) {
        work5(n - 2);
        for(int i = 1; i < n; i += 3) 
            paint(n - 1, i, n, i + 2);
        for(int i = 1; i < n - 3; i += 3) 
            paint(i, n - 1, i + 2, n);
    }
    for(int i = 1; i < n; i++) {
        for(int j = 1; j < n; j++) {
            if(mp[i][j]) cout << "#";
            else cout << ".";
        }
        cout << '\n';
    }
}
int main() {
    #ifdef zqj
    freopen("1.in","r",stdin);
    #endif
    ios :: sync_with_stdio(0), cin.tie(0);
    cin >> T;
    while(T--) Main();
    return 0; 
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

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

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 = 8, pans = 7 (test case 6)