QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#236550#2808. GardeningAhmed57#11 8ms3708kbC++231.5kb2023-11-04 05:27:312024-07-04 02:22:49

Judging History

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

  • [2024-07-04 02:22:49]
  • 评测
  • 测评结果:11
  • 用时:8ms
  • 内存:3708kb
  • [2023-11-04 05:27:31]
  • 提交

answer

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

signed main() {
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t;cin>>t;
    while(t--){
        int n,m,k;
        cin>>n>>m>>k;
        if(n&1||m&1){
            cout<<"NO\n";
            continue;
        }
        if(n==2){
            if(k!=m/2){
                cout<<"NO\n";
                continue;
            }
            cout<<"YES\n";
            for(int i = 0;i<n;i++){
                for(int j = 0;j<m;j++){
                    cout<<j/2+1<<" ";
                }
                cout<<endl;
            }
        }else{
            int ind = -1;
            for(int e = 0;e<=k;e++){
                if(e==1&&(k-e)%2==0)continue;
                if(e*2+(k-e)==m){
                    ind = e;
                }
            }
            if(ind==-1){
                cout<<"NO\n";
                continue;
            }
            cout<<"YES\n";
            for(int i = 0;i<n;i++){
                for(int j = 0;j<m;j++){
                    if(j>=ind*2){
                        cout<<(j-2*ind)/2+ind+1+(i>=2?(m-2*ind)/2:0)<<" ";
                    }else{
                        if(i==0||i==3||j==0||j==ind*2-1){
                            cout<<1<<" ";
                        }else{
                            cout<<(j-1)/2+2<<" ";
                        }
                    }
                }
                cout<<endl;
            }
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 8ms
memory: 3548kb

input:

28119
2 4 2
2 2 1
4 2 2
2 2 1
2 2 1
2 2 3
2 4 2
4 4 2
2 2 2
2 2 2
4 4 3
2 2 1
4 2 2
4 4 4
4 2 2
2 4 2
2 2 2
2 2 2
2 2 1
2 2 1
2 2 1
2 2 1
2 2 2
2 2 1
2 4 2
2 2 1
2 2 1
2 2 1
4 2 2
2 2 2
2 2 1
2 2 1
2 2 1
2 2 1
2 2 1
4 2 7
2 2 1
2 4 2
2 2 1
4 2 2
2 4 2
2 2 1
2 4 4
2 2 1
2 2 1
2 2 1
4 2 2
2 2 2
2 2 1
...

output:

YES
1 1 2 2 
1 1 2 2 
YES
1 1 
1 1 
YES
1 1 
1 1 
2 2 
2 2 
YES
1 1 
1 1 
YES
1 1 
1 1 
NO
YES
1 1 2 2 
1 1 2 2 
YES
1 1 1 1 
1 2 2 1 
1 2 2 1 
1 1 1 1 
NO
NO
NO
YES
1 1 
1 1 
YES
1 1 
1 1 
2 2 
2 2 
YES
1 1 2 2 
1 1 2 2 
3 3 4 4 
3 3 4 4 
YES
1 1 
1 1 
2 2 
2 2 
YES
1 1 2 2 
1 1 2 2 
NO
NO
YES
1 1 ...

result:

ok Correct! Azusa and Laika like the garden :) (28119 test cases)

Subtask #2:

score: 6
Accepted

Dependency #1:

100%
Accepted

Test #2:

score: 6
Accepted
time: 6ms
memory: 3688kb

input:

2953
2 2 1
2 12 6
2 34 17
2 26 51
2 2 1
2 2 1
2 24 12
4 4 2
4 50 45
2 28 14
4 4 4
4 48 48
2 22 11
2 26 13
4 2 2
4 2 2
2 22 11
2 38 19
2 40 20
2 38 19
2 40 20
4 30 23
2 16 8
4 4 3
2 44 2
4 42 85
2 2 1
2 32 53
2 2 1
4 18 60
2 6 9
2 10 5
2 50 25
4 26 77
2 2 4
2 40 20
4 4 4
2 2 1
2 2 1
2 36 2
2 18 9
4 4...

output:

YES
1 1 
1 1 
YES
1 1 2 2 3 3 4 4 5 5 6 6 
1 1 2 2 3 3 4 4 5 5 6 6 
YES
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 
NO
YES
1 1 
1 1 
YES
1 1 
1 1 
YES
1 1 2 2 3 3 4 4 5 5 6 6...

result:

ok Correct! Azusa and Laika like the garden :) (2953 test cases)

Test #3:

score: 0
Accepted
time: 8ms
memory: 3708kb

input:

2976
2 2 1
2 2 1
2 2 1
2 2 1
2 16 8
4 4 2
4 16 13
4 28 25
2 2 1
4 14 13
2 34 17
4 34 31
2 2 1
2 34 17
2 2 1
4 4 3
4 26 19
4 42 27
2 44 22
4 48 28
4 4 2
2 4 2
2 2 1
2 32 2
2 2 1
2 34 17
2 42 59
2 42 21
2 32 16
4 48 31
4 4 4
2 2 1
2 12 6
2 2 1
4 36 32
2 16 8
4 14 10
2 2 2
2 10 5
2 24 12
2 2 2
2 2 1
2 ...

output:

YES
1 1 
1 1 
YES
1 1 
1 1 
YES
1 1 
1 1 
YES
1 1 
1 1 
YES
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 
YES
1 1 1 1 
1 2 2 1 
1 2 2 1 
1 1 1 1 
YES
1 1 1 1 1 1 4 4 5 5 6 6 7 7 8 8 
1 2 2 3 3 1 4 4 5 5 6 6 7 7 8 8 
1 2 2 3 3 1 9 9 10 10 11 11 12 12 13 13 
1 1 1 1 1 1 9 9 10 10 1...

result:

ok Correct! Azusa and Laika like the garden :) (2976 test cases)

Subtask #3:

score: 0
Wrong Answer

Dependency #2:

100%
Accepted

Test #4:

score: 0
Wrong Answer
time: 5ms
memory: 3552kb

input:

2175
2 2 1
2 2 1
2 30 15
4 4 2
4 48 28
6 36 27
2 2 1
2 32 16
2 18 9
2 44 22
2 34 17
2 20 10
4 4 4
2 36 2
4 8 5
4 6 6
4 40 23
4 18 12
2 44 22
2 46 23
4 38 9
4 4 4
6 6 7
2 50 67
2 30 15
4 4 3
2 46 23
4 46 40
4 28 26
2 6 3
4 4 4
6 46 47
4 24 13
2 12 6
2 2 2
2 30 15
6 6 9
2 2 2
2 44 22
4 44 43
4 20 9
4 ...

output:

YES
1 1 
1 1 
YES
1 1 
1 1 
YES
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 
1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 
YES
1 1 1 1 
1 2 2 1 
1 2 2 1 
1 1 1 1 
YES
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

result:

wrong answer Output contains flowers without two equal neighbours (test case 6)

Subtask #4:

score: 0
Wrong Answer

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 3556kb

input:

311
2 2 1
12 12 14
6 6 6
40 40 297
28 28 82
30 30 74
4 4 10
38 38 210
6 6 4
42 42 365
8 8 11
16 16 30
6 6 7
22 22 38
10 10 5
2 2 2
12 12 19
16 16 52
28 28 124
26 26 92
2 2 2
28 28 25
20 20 19
18 18 43
4 4 3
30 30 78
26 26 130
18 18 58
26 26 59
6 6 4
10 10 6
14 14 34
18 18 184
12 12 108
18 18 35
30 3...

output:

YES
1 1 
1 1 
NO
YES
1 1 2 2 3 3 
1 1 2 2 3 3 
4 4 5 5 6 6 
4 4 5 5 6 6 
4 4 5 5 6 6 
4 4 5 5 6 6 
NO
NO
NO
NO
NO
YES
1 1 1 1 3 3 
1 2 2 1 3 3 
1 2 2 1 4 4 
1 1 1 1 4 4 
1 2 2 1 4 4 
1 2 2 1 4 4 
NO
NO
NO
NO
NO
YES
1 1 1 1 1 1 1 1 1 1 
1 2 2 3 3 4 4 5 5 1 
1 2 2 3 3 4 4 5 5 1 
1 1 1 1 1 1 1 1 1 1 
1...

result:

wrong answer Incorrect output (test case 2)

Subtask #5:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 1ms
memory: 3700kb

input:

310
44 2 22
36 8 195
2 2 4
2 50 61
12 42 275
4 4 5
26 30 416
24 20 252
20 32 498
30 30 130
32 48 1153
46 16 574
4 40 89
6 28 64
10 16 9
18 42 152
4 14 1
6 50 280
10 10 87
44 24 395
2 2 4
40 46 273
34 34 607
22 22 300
40 40 1166
10 48 211
42 22 334
6 10 20
38 38 189
6 10 36
14 14 33
44 48 1518
32 18 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 8 
1 2 2 3 3 4 4 5 5 6 6 7 7 1 8 8 
1 2 2 3 3 4 4 5 5 6 6 7 7 1 9 9 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 9 
1 2 2 3 3 4 4 5 5 6 6 7 7 1 9 9 
1 2 2 3 3 4 4 5 5 6 6 7 7 1 9 9 
1 2 2 3 3 4 4 5 5 6 6 7 7 1 9 9 
1 2 2 3 3 4 4 5 5 6 6 7...

result:

wrong answer Incorrect output (test case 1)

Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%