QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#650680#8217. King's Dinnerucup-team3160#AC ✓1ms3760kbC++142.6kb2024-10-18 16:06:232024-10-18 16:06:24

Judging History

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

  • [2024-10-18 16:06:24]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3760kb
  • [2024-10-18 16:06:23]
  • 提交

answer

#include <bits/stdc++.h>
#define rep(i, min, max) for(int i = (min); i <= (max); ++i)
#define nrep(i, max, min) for(int i = (max); i >= (min); --i)
#define reads(str) (scanf("%s", str + 1), strlen(str + 1))
#define case() int Ts = read(); rep(T, 1, Ts)
#define putf(flag) puts((flag) ? "Yes" : "No")
#define put(x) printf("%d ", x)
#define putl(x) printf("%lld ", x)
#define endl() putchar('\n')
using namespace std;

void print() { cerr << endl; }
template<typename T, typename ...Ts>
void print(T x, Ts ...xs) { cerr << x << " "; print(xs...); }

typedef long long ll;
inline ll read()
{
    ll now=0; bool nev=false; char c=getchar();
    while(c<'0' || c>'9') { if(c=='-') nev=true; c=getchar(); }
    while(c>='0' && c<='9') { now=(now<<1)+(now<<3)+(c&15); c=getchar(); }
    return nev?-now:now;
}

const int N = 200 + 10;

int a[N][N];
int ax, ay;

inline int& f(int x, int y) {
    return a[x + ax][y + ay];
}

int main() {
    case() {
        int n = read(), n0 = n; ax = 0, ay = 0;
        rep(i, 1, n) rep(j, 1, n) a[i][j] = 0;
        while(1) {
            if(n % 2 == 0 && n >= 6) {
                rep(i, 1, n - 2) if(i % 2 != 0) {
                    f(1, i) = f(2, i) = f(i, n) = f(i, n - 1) = f(n, n - i + 1) = f(n - 1, n - i + 1) = f(n - i + 1, 1) = f(n - i + 1, 2) = 1;
                }
                ax += 3, ay += 3;
                n -= 6;
            } else if(n % 3 == 1 && n >= 4) {
                rep(i, 1, n - 1) if(i % 3 != 0) {
                    a[1 + ax][i + ay] = a[i + ax][n + ay] = a[n + ax][n - i + 1 + ay] = a[n - i + 1 + ax][1 + ay] = 1;
                }
                ax += 2, ay += 2;
                n -= 4;
            } else if(n % 3 == 0 && n >= 4) {
                rep(i, 1, n) if(i % 3 != 0) f(i, 1) = f(i, n) = 1;
                rep(i, 2, n - 2) if(i % 3 != 2) f(1, i) = f(n, i) = 1;
                ax += 2, ay += 2;
                n -= 4;
                
            } else {
                break;
            }
        }
        int xlim = n, ylim = n;
        while((xlim + 1) % 3 != 0) xlim --;
        while((ylim + 1) % 2 != 0) ylim --;
        rep(i, 1, n) {
            rep(j, 1, n) {
                if(j % 2 != 0 && i % 3 != 0 && i <= xlim && j <= ylim) {
                    a[i + ax][j + ay] = 1;
                }
            }
        }
        if(n % 3 == 1) rep(i, 1, xlim) if(i % 3 != 0) a[n + ax][i + ay] = 1;
        n = n0;
        rep(i, 1, n) {
            rep(j, 1, n) {
                if(a[i][j]) putchar('#');
                else putchar('.');
            }
            putchar('\n');
        }
            // putchar('\n');
    }
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 1ms
memory: 3760kb

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: 1ms
memory: 3656kb

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: 1ms
memory: 3728kb

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