QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511814#8217. King's DinnerDinalAC ✓5ms3772kbC++142.7kb2024-08-10 11:35:052024-08-10 11:35:09

Judging History

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

  • [2024-08-10 11:35:09]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:3772kb
  • [2024-08-10 11:35:05]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
template<typename T>
void read(T &a){
    #define gc getchar()
    char c;a=0;int f=1;
    while(!isdigit(c=gc))if(c=='-')f=-1;
    do a=a*10+c-'0';
    while(isdigit(c=gc));
    a*=f;
}
template<typename T>
void write(T a){
    if(a<0)putchar('-'),a=-a;
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> PII;
typedef pair<ll,int> PLI;
mt19937 eg;
namespace REIMU{
char a[8][8][8];
void init(){
    for(int i=1;i<=7;++i)
        for(int j=1;j<=i;++j)
            for(int k=1;k<=i;++k)
                a[i][j][k]='.';
    a[2][1][1]=a[2][2][1]='#';
    a[3][1][1]=a[3][2][1]=a[3][1][3]=a[3][2][3]='#';
    a[4][1][1]=a[4][1][2]='#';
    a[4][1][4]=a[4][2][4]='#';
    a[4][3][1]=a[4][4][1]='#';
    a[4][4][3]=a[4][4][4]='#';
    for(int i=1;i<=4;i+=3)
        for(int j=1;j<=5;j+=2)
            a[5][i][j]=a[5][i+1][j]='#';
    a[6][1][1]=a[6][1][2]='#';
    a[6][3][1]=a[6][3][2]='#';
    a[6][1][4]=a[6][2][4]='#';
    a[6][1][6]=a[6][2][6]='#';
    a[6][5][1]=a[6][6][1]='#';
    a[6][5][3]=a[6][6][3]='#';
    a[6][4][5]=a[6][4][6]='#';
    a[6][6][5]=a[6][6][6]='#';
    a[7][1][1]=a[7][1][2]='#';
    a[7][1][4]=a[7][1][5]='#';
    for(int i=3;i<=6;i+=3)
        for(int j=1;j<=7;j+=2)
            a[7][i][j]=a[7][i+1][j]='#';
}
char b[110][110];
void solve(int n){
    if(n<=8){
        n--;
        for(int i=1;i<=n;++i)
            for(int j=1;j<=n;++j)
                b[i][j]=a[n][i][j];
        return;
    }
    for(int i=n-6+1;i<=n;i+=3)
        for(int j=n-6+1;j<=n;j+=2)
            b[i+1][j]=b[i][j]='#';
    if(n%2==0){
        for(int i=1;i<=n-6;i+=2)
            for(int j=n-5;j<=n;j+=3){
                b[i][j]=b[i][j+1]='#';
                b[j+1][i]=b[j][i]='#';
            }
    }else{
        for(int i=1;i<=n-6-3;i+=2){
            for(int j=n-5;j<=n;j+=3){
                b[i][j]=b[i][j+1]='#';
                b[j+1][i]=b[j][i]='#';
            }
        }
        for(int i=n-6+1;i<=n;i+=2){
            b[i][n-6-2]=b[i][n-6-1]='#';
            b[n-6-2][i]=b[n-6-1][i]='#';
        }
    }
    solve(n-6);
}
void main(){
    int n;
    cin>>n;
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n;++j)
            b[i][j]='.';
    solve(n+1);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n;++j)
            printf("%c",b[i][j]);
        puts("");
    }
}
}
int main(){
    // freopen("1.in","r",stdin);
    eg.seed(chrono::system_clock::now().time_since_epoch().count());
    int T;cin>>T;
    REIMU::init();
    while(T--)REIMU::main();
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 2ms
memory: 3744kb

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: 5ms
memory: 3616kb

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: 3ms
memory: 3772kb

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed