QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#320821#8217. King's Dinnerucup-team1631#AC ✓2ms3832kbC++203.4kb2024-02-03 21:58:532024-02-03 21:58:54

Judging History

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

  • [2024-02-03 21:58:54]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3832kb
  • [2024-02-03 21:58:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using vvvvb = vector<vvvb>;
using vvvvvb = vector<vvvvb>;
#define all(A) A.begin(),A.end()
#define rep(i, n) for (ll i = 0; i < (ll) (n); i++)
template<class T>
bool chmax(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p < q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}
template<class T>
bool chmin(T& p, T q, bool C = 1) {
    if (C == 0 && p == q) {
        return 1;
    }
    if (p > q) {
        p = q;
        return 1;
    }
    else {
        return 0;
    }
}
ll modPow(long long a, long long n, long long p) {
    if (n == 0) return 1; // 0乗にも対応する場合
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}
ll cnt = 0;
ll gcd(ll(a), ll(b)) {
    cnt++;
    if (a == 0)return b;
    if (b == 0)return a;
    ll c = a;
    while (a % b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return b;
}
ll sqrtz(ll N) {
    ll L = 0;
    ll R = sqrt(N) + 10000;
    while (abs(R - L) > 1) {
        ll mid = (R + L) / 2;
        if (mid * mid <= N)L = mid;
        else R = mid;
    }
    return L;
}

bool DEB=0;
void solve(ll N){
    vvll A(N,vll(N,0));
    if(DEB)cout<<N<<endl;
    if(N%6==0){
        rep(i,N/3-1){
            rep(j,N/2-1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
        rep(j,N/3-1){
            A[N-1][j*3]=A[N-1][j*3+1]=1;
            A[N-3][j*3]=A[N-3][j*3+1]=1;
        }
        rep(i,N/2-1){
            A[2*i][N-2]=A[2*i][N-1]=1;
        }
        A[N-1][N-3]=A[N-2][N-3]=1;
        A[N-1][N-1]=A[N-2][N-1]=1;
        
    }
    else if(N%6==1){
        rep(i,N/3){
            rep(j,N/2+1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
        rep(j,N/3){
            A[N-1][j*3]=A[N-1][j*3+1]=1;
        }
    }
    else if(N%6==2){
        rep(i,N/3+1){
            rep(j,N/2-1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
        rep(i,N/2){
            A[i*2][N-1]=A[i*2][N-2]=1;
        }
    }
    else if(N%6==3){
        rep(i,N/3-1){
            rep(j,N/2+1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
        rep(j,N/3){
            A[N-1][j*3]=A[N-1][j*3+1]=1;
            A[N-3][j*3]=A[N-3][j*3+1]=1;
        }
    }
    else if(N%6==4){
        rep(i,N/3){
            rep(j,N/2-1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
        rep(i,N/2-1){
            A[i*2][N-2]=A[i*2][N-1]=1;
        }
        rep(j,N/3){
            A[N-1][j*3]=A[N-1][j*3+1]=1;
        }
        A[N-1][N-1]=A[N-2][N-1]=1;
    }
    else if(N%6==5){
        rep(i,N/3+1){
            rep(j,N/2+1){
                A[i*3][j*2]=A[i*3+1][j*2]=1;
            }
        }
    }

    rep(i,N){
        rep(j,N)cout<<(A[i][j]==0?'.':'#');
        cout<<endl;
    }
    if(DEB)cout<<endl;
}

int main() {

    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    ll T;
    cin>>T;
    rep(t,T){
        ll N;
        cin>>N;
        solve(N);
    }
}

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

详细

Test #1:

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

input:

3
1
2
3

output:

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

result:

ok all tests correct (3 test cases)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3660kb

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: 0ms
memory: 3792kb

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

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

input:

1
100

output:

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

result:

ok all tests correct (1 test case)

Extra Test:

score: 0
Extra Test Passed