QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#577965#8217. King's Dinnerucup-team3519#AC ✓4ms3776kbC++202.2kb2024-09-20 15:43:232024-09-20 15:43:27

Judging History

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

  • [2024-09-20 15:43:27]
  • 评测
  • 测评结果:AC
  • 用时:4ms
  • 内存:3776kb
  • [2024-09-20 15:43:23]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
int a[205][205];
void init(int n){
    for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)a[i][j]=0;
}
void output(int n){
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(a[i][j])cout<<"#";
            else cout<<".";
        }
        cout<<'\n';
    }
}
void draw(int x,int y,int lenx,int leny){
    // if(lenx==0||leny==0)return;
    if(lenx==leny&&lenx!=6){
        if(lenx<=2)return;
        if(lenx==3){
            draw(x,y,2,3);
            return;
        }
        if(lenx==4){
            draw(x,y,3,4);
            return;
        }
        if(lenx==5){
            draw(x,y,2,3);
            draw(x+2,y,3,2);
            draw(x,y+3,3,2);
            draw(x+3,y+2,2,3);
            return;
        }
        if(lenx==7){
            draw(x,y,3,4);
            draw(x+3,y,4,3);
            draw(x,y+4,4,3);
            draw(x+4,y+3,3,4);
            return;
        }
        if(lenx>7){
            draw(x,y,6,6);
            draw(x+6,y,lenx-6,6);
            draw(x,y+6,6,leny-6);
            draw(x+6,y+6,lenx-6,leny-6);
            return;
        }
    }
    assert(lenx*leny%6==0);
    if(lenx==2&&leny==3){
        a[x][y]=a[x][y+1]=1;
        return;
    }
    if(lenx==3&&leny==2){
        a[x][y]=a[x+1][y]=1;
        return;
    }
    if(lenx%2==0&&leny%3==0){
        for(int i=x;i<x+lenx;i+=2){
            for(int j=y;j<y+leny;j+=3){
                draw(i,j,2,3);
            }
        }
        return;
    }
    if(lenx%3==0&&leny%2==0){
        for(int i=x;i<x+lenx;i+=3){
            for(int j=y;j<y+leny;j+=2){
                draw(i,j,3,2);
            }
        }
        return;
    }
    if(lenx%6==0){
        draw(x,y,lenx,2);
        draw(x,y+2,lenx,leny-2);
        return;
    }
    if(leny%6==0){
        draw(x,y,2,leny);
        draw(x+2,y,lenx-2,leny);
        return;
    }
    assert(0);
    
}
void solve(){
    int n;
    cin>>n;
    n++;
    init(n);
    draw(0,0,n,n);
    output(n-1);
}
int main() {
    ios::sync_with_stdio(0),cin.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
}    

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

Details

Tip: Click on the bar to expand more detailed information

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

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: 4ms
memory: 3716kb

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: 2ms
memory: 3776kb

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed