QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#359202#8217. King's Dinnerinstallb#WA 0ms3624kbC++202.0kb2024-03-20 14:40:112024-03-20 14:40:12

Judging History

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

  • [2024-03-20 14:40:12]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2024-03-20 14:40:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

char c[105][105];

void dfs(int n,int ad){
    if(n <= 2) return;
    if(n == 3){
        c[ad + 1][ad + 1] = '#';
        c[ad + 2][ad + 1] = '#';
        return;
    }
    if(n == 4){
        c[ad + 1][ad + 1] = '#';
        c[ad + 2][ad + 1] = '#';
        c[ad + 1][ad + 3] = '#';
        c[ad + 2][ad + 3] = '#';
        return;
    }
    if(n % 3 == 0){
        for(int i = 1;i <= n;i += 2){
            for(int j = 1;j <= n;j += 3){
                c[ad + i][ad + j] = c[ad + i][ad + j + 1] = '#';
            }
        }
    }
    if(n % 3 == 1){
        for(int i = 1;i <= n - 4;i += 3){
            c[ad + 1][ad + i] = c[ad + 1][ad + i + 1] = '#'; c[ad + 3][ad + i] = c[ad + 3][ad + i + 1] = '#';
            c[ad + i][ad + n - 1] = c[ad + i + 1][ad + n - 1] = '#'; c[ad + i][ad + n - 3] = c[ad + i + 1][ad + n - 3] = '#';
            c[ad + n - 1][ad + n - i] = c[ad + n - 1][ad + n - i - 1] = '#'; c[ad + n - 3][ad + n - i] = c[ad + n - 3][ad + n - i - 1] = '#';
            c[ad + n - i][ad + 1] = c[ad + n - i - 1][ad + 1] = '#'; c[ad + n - i][ad + 3] = c[ad + n - i - 1][ad + 3] = '#';
        }
        dfs(n - 8,ad + 4);
    }
    if(n % 3 == 2){
        for(int i = 1;i <= n - 2;i += 3){
            c[ad + 1][ad + i] = c[ad + 1][ad + i + 1] = '#';
            c[ad + i][ad + n - 1] = c[ad + i + 1][ad + n - 1] = '#';
            c[ad + n - 1][ad + n - i] = c[ad + n - 1][ad + n - i - 1] = '#';
            c[ad + n - i][ad + 1] = c[ad + n - i - 1][ad + 1] = '#';
        }
        dfs(n - 4,ad + 2);
    }
}

void solve(){
    int n; cin >> n; n ++;
    for(int i = 1;i < n;i ++){
        for(int j = 1;j < n;j ++){
            c[i][j] = '.';
        }
    }
    dfs(n,0);
    for(int i = 1;i < n;i ++){
        for(int j = 1;j < n;j ++){
            cout << c[i][j];
        }
        cout << '\n';
    }
}

int main(){
    ios::sync_with_stdio(false);
    int TC;
    cin >> TC;
    while(TC --) solve();
    return 0;
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
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:

wrong answer jury has the better answer: jans = 13, pans = 12 (test case 8)