QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595611#6643. Graphs and ColorsUESTC_DECAYALI#AC ✓6ms3724kbC++20985b2024-09-28 14:06:352024-09-28 14:06:36

Judging History

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

  • [2024-09-28 14:06:36]
  • 评测
  • 测评结果:AC
  • 用时:6ms
  • 内存:3724kb
  • [2024-09-28 14:06:35]
  • 提交

answer

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

const int N = 105;
int edg[N][N];

void solve() {
    int n, k; cin >> n >> k;
    if (k>n/2) {
        cout << "NO\n"; return ;
    }

    for (int i=1; i<=n; ++i) for (int j=1; j<=n; ++j) edg[i][j] = 0;

    auto inv = [&](int a) {return n+1-a;};
    for (int c=1; c<=n/2; ++c) {
        edg[c][inv(c)] = c;
        for (int i=1; i<c; ++i) edg[c][inv(i)] = c, edg[i][inv(c)] = c;
        for (int i=c+1; i<=n/2; ++i) edg[c][i] = c, edg[inv(i)][inv(c)] = c;
    }
    
    if (n%2==1) {
        for (int i=1; i<=n/2; ++i) edg[i][(n+1)/2] = i, edg[(n+1)/2][inv(i)] = i;
    }

    cout << "YES\n";
    for (int i=2; i<=n; ++i) {
        for (int j=1; j<i; ++j) {
            if (edg[j][i]>k) edg[j][i] = 1;
            cout << edg[j][i] << ' ';
        }
        cout << '\n';
    }
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0);
    int t; cin >> t; while (t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

768
8 24
7 20
17 61
17 76
16 100
16 16
15 59
9 17
14 31
14 61
10 32
17 55
5 7
10 29
14 82
13 47
17 32
5 10
16 76
14 59
8 28
13 19
12 41
13 41
11 32
11 53
3 2
16 52
16 87
7 12
9 15
15 65
15 53
17 47
6 15
12 1
14 35
16 60
12 31
14 70
15 88
12 2
8 23
12 38
16 111
16 117
5 4
14 90
12 55
15 41
15 48
15 4...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
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 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 1 1 
1 1 1 1 1 1 1 1 1 1 1 
NO
NO
NO
NO
NO
YES
1 
1 2 
1 2 1 
1 2 1 1 
1 2 1...

result:

ok t=768 (768 test cases)

Test #2:

score: 0
Accepted
time: 3ms
memory: 3716kb

input:

350
17 100
30 16
18 42
18 31
17 133
18 21
52 26
28 14
18 71
18 2
52 27
42 22
88 44
37 18
18 72
80 40
18 133
18 69
40 21
16 9
17 99
51 26
17 111
97 48
17 96
18 142
18 9
18 10
18 84
14 8
18 30
61 30
18 122
7 3
74 37
18 16
17 89
17 101
36 18
84 42
4 2
68 34
18 126
79 39
23 12
63 31
18 81
32 16
18 143
1...

output:

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

result:

ok t=350 (350 test cases)

Test #3:

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

input:

173
67 32
29 13
37 17
60 31
72 35
92 45
90 44
45 6
45 7
36 17
76 37
10 4
6 2
45 943
9 3
79 38
83 42
45 982
45 483
88 43
91 46
45 1
20 9
96 49
80 39
55 26
48 23
65 33
89 43
41 19
84 43
63 30
88 45
98 50
50 24
15 6
100 49
93 47
49 23
97 47
96 47
45 818
45 3
45 703
22 10
23 10
46 22
7 2
65 31
28 13
83 ...

output:

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

result:

ok t=173 (173 test cases)

Test #4:

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

input:

210
45 895
45 41
50 32
45 283
50 1224
50 28
45 44
50 1201
45 955
45 967
50 18
50 1205
50 1216
45 977
50 1219
45 958
50 9
50 852
45 962
45 971
50 1202
50 1225
50 818
50 16
50 1096
45 978
50 488
50 489
50 31
45 43
50 599
45 953
50 1203
45 980
45 960
45 16
50 1223
45 954
50 10
50 63
45 187
50 20
50 121...

output:

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

result:

ok t=210 (210 test cases)

Test #5:

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

input:

172
61 1145
61 19
50 1182
61 482
61 534
61 587
50 250
61 27
61 1821
50 1177
61 550
61 1795
61 825
61 1798
61 6
61 24
61 22
50 1212
61 1829
61 1175
50 1190
61 279
50 1180
61 1813
61 1827
61 649
61 8
50 746
50 46
61 1617
50 1183
50 1178
61 1794
50 546
61 1824
61 29
50 844
50 40
61 668
61 1801
61 1811
...

output:

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

result:

ok t=172 (172 test cases)

Test #6:

score: 0
Accepted
time: 3ms
memory: 3692kb

input:

130
89 989
89 3911
61 54
61 524
61 56
61 307
61 1771
61 1473
61 1776
61 52
61 1775
61 45
89 3195
61 46
89 3913
61 44
61 1780
89 8
89 3898
61 1785
61 1778
61 57
89 3916
61 1777
61 59
89 3907
89 1633
89 19
61 58
89 3908
89 3905
89 3894
89 20
89 10
61 246
61 60
89 2560
89 1905
61 1436
61 82
89 515
89 1...

output:

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

result:

ok t=130 (130 test cases)

Test #7:

score: 0
Accepted
time: 3ms
memory: 3624kb

input:

112
89 55
89 3495
89 3885
89 1434
89 54
89 3890
89 2629
89 3857
89 3856
89 38
89 3870
89 31
89 2905
89 992
89 60
89 1081
89 36
89 1167
89 3869
89 1752
89 26
89 56
89 1631
89 41
89 1425
89 473
89 2802
89 3563
89 2237
89 3878
89 37
89 59
89 3862
89 44
89 1087
89 3861
89 1420
89 3876
89 27
89 3863
89 3...

output:

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

result:

ok t=112 (112 test cases)

Test #8:

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

input:

112
89 3839
89 86
89 88
90 3997
89 69
89 3842
89 2987
89 3855
90 8
89 3828
89 63
90 3999
90 1755
89 1088
89 2205
89 3853
89 84
90 416
89 72
90 438
90 3998
89 3758
90 2092
89 1605
90 1
89 3845
90 3
89 3835
89 2215
89 3843
89 79
89 3575
89 73
89 339
90 5
90 4002
90 4
90 9
89 3833
89 799
90 4003
89 404...

output:

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

result:

ok t=112 (112 test cases)

Test #9:

score: 0
Accepted
time: 6ms
memory: 3632kb

input:

111
90 3988
90 36
90 40
90 3225
90 14
90 3963
90 788
90 3968
90 3698
90 3977
90 2803
90 3653
90 13
90 44
90 20
90 2590
90 3970
90 314
90 45
90 30
90 3155
90 3983
90 3974
90 25
90 19
90 413
90 2197
90 340
90 46
90 1370
90 3966
90 2060
90 2615
90 42
90 39
90 152
90 3976
90 631
90 3959
90 3990
90 829
9...

output:

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

result:

ok t=111 (111 test cases)

Test #10:

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

input:

111
90 52
90 53
90 3947
90 2535
90 68
90 2333
90 3936
90 3949
90 2585
90 3938
90 75
90 2640
90 3951
90 3937
90 65
90 3932
90 1531
90 82
90 3952
90 58
90 3945
90 1441
90 57
90 54
90 3948
90 1520
90 3946
90 861
90 60
90 72
90 3925
90 66
90 50
90 195
90 71
90 2243
90 81
90 3943
90 55
90 3935
90 3950
90...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok t=111 (111 test cases)

Test #11:

score: 0
Accepted
time: 5ms
memory: 3700kb

input:

103
98 2200
90 90
98 25
90 1775
98 1238
90 89
90 3918
98 24
98 28
98 4743
98 1694
90 2673
98 1706
98 4745
98 4739
90 3919
90 3732
98 1421
98 22
98 3170
98 4730
90 3294
98 4753
98 2411
98 7
98 9
98 709
98 4735
98 20
98 4727
98 4733
98 2120
98 12
98 4741
98 21
98 18
98 4736
98 2
90 3917
90 3920
98 14
...

output:

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

result:

ok t=103 (103 test cases)

Test #12:

score: 0
Accepted
time: 4ms
memory: 3636kb

input:

102
98 57
98 379
98 1777
98 4697
98 54
98 33
98 4720
98 1405
98 43
98 50
98 4118
98 3164
98 56
98 3977
98 29
98 4750
98 4706
98 4700
98 4723
98 3451
98 4699
98 60
98 1279
98 2999
98 38
98 4702
98 3343
98 4714
98 4698
98 4692
98 3061
98 4588
98 4716
98 4701
98 4705
98 40
98 1415
98 30
98 4724
98 52
9...

output:

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

result:

ok t=102 (102 test cases)

Test #13:

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

input:

102
98 4677
98 4661
98 4676
98 63
98 78
98 3606
98 1110
98 4687
98 4545
98 4592
98 91
98 3690
98 93
98 65
98 81
98 4689
98 73
98 2840
98 4685
98 4684
98 87
98 1246
98 3425
98 1109
98 4672
98 4109
98 4658
98 4680
98 3977
98 634
98 64
98 79
98 85
98 151
98 4667
98 68
98 66
98 2263
98 4675
98 92
98 244...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok t=102 (102 test cases)

Test #14:

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

input:

101
99 4628
99 24
98 4656
99 2634
99 4820
99 1862
99 4849
99 21
99 10
99 25
99 2341
99 5
99 4844
99 1230
99 4841
98 98
99 4776
99 3
99 1748
99 19
99 26
99 2
99 27
99 1
99 14
99 4830
98 4036
99 20
99 2096
99 4847
99 3797
99 31
99 4828
99 32
99 4837
99 2609
99 4838
99 2590
99 200
99 4832
99 4665
99 48...

output:

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

result:

ok t=101 (101 test cases)

Test #15:

score: 0
Accepted
time: 3ms
memory: 3628kb

input:

101
99 39
99 4792
99 4666
99 1213
99 3314
99 1930
99 36
99 1287
99 1852
99 4842
99 52
99 46
99 912
99 4798
99 3835
99 47
99 58
99 4803
99 48
99 38
99 4817
99 3917
99 57
99 65
99 4804
99 1514
99 3199
99 35
99 41
99 4797
99 54
99 2408
99 4789
99 2918
99 2729
99 51
99 4623
99 50
99 2716
99 45
99 659
99...

output:

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

result:

ok t=101 (101 test cases)

Test #16:

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

input:

101
99 77
99 4753
99 4780
99 72
99 4771
99 4769
99 90
99 71
99 4160
99 98
99 4776
99 2346
99 4761
99 81
99 791
99 4764
99 3679
99 991
99 4756
99 86
99 4785
99 2902
99 4754
99 4762
99 4772
99 581
99 1405
99 89
99 3349
99 4614
99 3333
99 93
99 4774
99 69
99 4765
99 67
99 73
99 1581
99 94
99 1168
99 47...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok t=101 (101 test cases)

Test #17:

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

input:

100
100 4479
100 880
100 2575
100 4949
100 4924
100 1353
100 18
100 4919
100 31
100 4929
100 3271
100 4937
100 6
100 9
100 4931
100 23
100 4927
100 4923
100 4944
100 256
100 12
100 4940
100 4930
100 4493
100 10
100 34
100 11
100 30
100 4934
100 251
100 4504
100 2044
100 4939
100 29
100 347
100 758
1...

output:

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

result:

ok t=100 (100 test cases)

Test #18:

score: 0
Accepted
time: 3ms
memory: 3696kb

input:

100
100 4890
100 41
100 177
100 4907
100 4916
100 1331
100 37
100 53
100 4896
100 768
100 375
100 4911
100 3508
100 59
100 62
100 4884
100 50
100 4913
100 43
100 3185
100 63
100 4895
100 57
100 45
100 2572
100 4905
100 64
100 40
100 147
100 4914
100 67
100 2051
100 52
100 4810
100 56
100 4902
100 58...

output:

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

result:

ok t=100 (100 test cases)

Test #19:

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

input:

100
100 4868
100 99
100 4880
100 3031
100 1253
100 96
100 2580
100 2564
100 3210
100 4883
100 3037
100 83
100 2916
100 4732
100 1481
100 4870
100 91
100 4869
100 1660
100 863
100 73
100 533
100 92
100 84
100 1802
100 4858
100 71
100 4006
100 4864
100 3015
100 4854
100 288
100 4860
100 540
100 70
100...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok t=100 (100 test cases)