QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#292867#5529. Most Annoying Constructive Problemucup-team1447#AC ✓18ms4740kbC++144.1kb2023-12-28 15:39:482023-12-28 15:39:49

Judging History

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

  • [2023-12-28 15:39:49]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:4740kb
  • [2023-12-28 15:39:48]
  • 提交

answer

// This Code was made by Chinese_zjc_.
#include <bits/stdc++.h>
// #define debug
std::vector<int> trans(std::vector<int> p)
{
    std::vector<int> rk(p.size());
    std::iota(rk.begin(), rk.end(), 0);
    std::sort(rk.begin(), rk.end(), [&](const int &A, const int &B)
              { return p[A] < p[B]; });
    for (std::size_t i = 0; i != p.size(); ++i)
        p[rk[i]] = i;
    return p;
}
int calc(std::vector<int> p)
{
    bool v[p.size()][p.size()];
    std::memset(v, false, sizeof(v));
    for (std::size_t i = 0; i != p.size(); ++i)
        for (std::size_t j = i; ++j != p.size();)
            v[i][j] = p[i] > p[j];
    for (std::size_t i = 0; i != p.size(); ++i)
        for (std::size_t j = i; ++j != p.size();)
            v[i][j] ^= v[i][j - 1];
    for (std::size_t i = p.size() - 1; i--;)
        for (std::size_t j = i; j != p.size(); ++j)
            v[i][j] ^= v[i + 1][j];
    int res = 0;
    for (std::size_t i = 0; i != p.size(); ++i)
        for (std::size_t j = i; j != p.size(); ++j)
            res += v[i][j];
    return res;
}
std::vector<int> insert(const std::vector<int> &p, std::vector<int>::const_iterator i, int v)
{
    std::vector<int> res = p;
    for (auto &i : res)
        i += i >= v;
    res.insert(res.begin() + (i - p.begin()), v);
    return res;
}
int calcmax(int n) { return ((n - 1) * (n - 1) + 1 + (n == 3)) / 2; }
bool able(int n, int k) { return n >= 1 && 0 <= k && k <= calcmax(n); }
std::vector<int> gen(int n, int k)
{
    if (n == 3 && k == 3)
        return {2, 1, 0};
    if (k == calcmax(n) - (n == 3))
    {
        std::vector<int> p;
        for (int i = 0; i != n; ++i)
            p.push_back(i & 1 ? i : i + 4);
        return trans(p);
    }
    if (n % 2 == 0 && k == calcmax(n) - 1)
    {
        std::vector<int> p;
        for (int i = 0; i != n; ++i)
            p.push_back(i & 1 ? i + 4 : i);
        return trans(p);
    }
    if (able(n - 2, k - n + 1))
    {
        std::vector<int> p = gen(n - 2, k - n + 1);
        p.push_back(n - 1);
        p.push_back(n - 2);
        return p;
    }
    if (k < n)
    {
        std::vector<int> p(n);
        std::iota(p.begin(), p.end(), 0);
        if (k == n - 1)
            std::swap(p[0], p[1]);
        else if (k)
            std::rotate(p.end() - k - 2, p.end() - k - 1, p.end() - k + 1);
        return p;
    }
    {
        std::vector<int> p = gen(n - 1, calcmax(n - 1));
        for (int i = 0; i <= n; ++i)
        {
            int cur = calcmax(n - 1);
            bool v = false;
            for (int j = n - 1; j--;)
            {
                v ^= p[j] >= i;
                cur += v ^ (j < n - 3 || (j == n - 3 && p[n - 3] > p[n - 2]));
            }
            if (cur == k)
                return insert(p, p.end(), i);
        }
    }
    {
        std::vector<int> p = gen(n - 1, calcmax(n - 1) - 1);
        for (int i = 0; i <= n; ++i)
        {
            int cur = calcmax(n - 1) - 1;
            bool v = false;
            for (int j = n - 1; j--;)
            {
                v ^= p[j] >= i;
                cur += v ^ (j < n - 3 || (j == n - 3 && p[n - 3] > p[n - 2]));
            }
            if (cur == k)
                return insert(p, p.end(), i);
        }
    }
    std::cout << n << ' ' << k << std::endl;
    assert(false);
}
int T, n, k;
signed main()
{
    std::ios::sync_with_stdio(false);
    std::cin >> T;
    while (T--)
    {
        std::cin >> n >> k;
        if (able(n, k))
        {
            std::cout << "YES" << std::endl;
            for (auto i : gen(n, k))
                std::cout << i + 1 << ' ';
            std::cout << std::endl;
            assert(calc(gen(n, k)) == k);
        }
        else
            std::cout << "NO" << std::endl;
        // std::vector<int> p;
        // std::iota(p.begin(), p.end(), 0);
        // do
        // {
        //     std::cout << calc(p);
        //     for (auto i : p)
        //         std::cout << ' ' << i;
        //     std::cout << std::endl;
        // } while (std::next_permutation(p.begin(), p.end()));
    }
    return 0;
}

详细

Test #1:

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

input:

4
1 0
3 3
4 1
6 15

output:

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

result:

ok Correct (4 test cases)

Test #2:

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

input:

5951
27 255
28 371
31 320
33 201
32 199
31 108
15 78
27 32
24 268
20 4
14 82
29 202
33 85
26 104
31 380
27 330
20 140
29 192
21 63
17 89
20 41
32 444
20 76
27 114
33 330
26 249
33 301
24 87
25 72
14 49
25 281
21 58
15 48
16 19
14 0
22 175
11 7
30 43
31 259
22 112
12 30
30 111
33 268
30 287
19 150
15...

output:

YES
1 4 2 6 3 8 5 10 7 12 9 14 11 17 13 19 15 20 18 21 16 23 22 25 24 27 26 
NO
YES
3 1 5 2 8 4 10 7 12 9 14 11 16 13 18 15 20 17 21 19 6 23 22 25 24 27 26 29 28 31 30 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 15 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 
YES
1 2 3 4 5 6 7 9 10 8 11 12 13 14...

result:

ok Correct (5951 test cases)

Test #3:

score: 0
Accepted
time: 16ms
memory: 3784kb

input:

3201
37 408
37 275
34 107
35 521
36 552
37 582
35 81
36 53
34 16
33 40
34 70
33 305
36 367
35 55
35 15
35 416
33 92
36 590
33 206
35 241
34 404
36 154
35 582
33 359
36 25
37 412
38 162
36 579
34 194
35 92
36 429
36 458
37 662
35 71
34 78
35 90
36 304
33 448
36 98
36 605
34 31
34 421
35 509
37 90
36 ...

output:

YES
3 1 6 2 8 4 10 7 12 9 14 11 16 13 18 15 19 17 5 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 
YES
1 2 3 4 5 6 7 8 9 10 12 13 11 14 15 16 17 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 
YES
1 2 3 4 5 6 7 8 9 10 11 12 14 15 13 16 17 18 19 20 21 22 23 24 25 26 27 28 30 29 3...

result:

ok Correct (3201 test cases)

Test #4:

score: 0
Accepted
time: 14ms
memory: 3556kb

input:

2587
39 606
40 291
40 10
40 382
38 71
40 558
38 179
41 178
40 479
39 596
40 356
41 303
39 415
38 528
39 204
39 432
38 484
38 365
38 690
38 431
40 733
38 364
40 746
40 409
40 240
41 342
39 278
38 79
39 573
39 118
38 653
40 600
40 252
38 628
40 611
41 242
40 650
39 195
38 114
39 551
39 620
40 15
38 51...

output:

YES
4 2 6 3 8 5 10 7 12 9 14 11 16 13 18 15 20 17 22 19 24 21 26 23 28 25 30 27 32 29 33 31 1 35 34 37 36 39 38 
YES
1 2 3 4 5 6 7 8 10 11 9 12 13 14 15 16 17 18 19 20 21 22 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 
YES
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 2...

result:

ok Correct (2587 test cases)

Test #5:

score: 0
Accepted
time: 12ms
memory: 3564kb

input:

2277
41 527
41 310
41 697
41 108
42 610
41 320
42 390
43 482
43 266
42 2
42 599
43 95
43 204
41 392
42 29
41 57
43 201
42 465
43 166
43 169
42 471
41 539
41 358
41 100
43 60
42 475
42 604
41 451
41 246
42 61
42 113
42 36
43 437
41 532
43 582
43 573
41 312
42 638
42 590
42 632
42 621
43 464
41 654
43...

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 16 12 18 14 20 17 22 19 23 21 15 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 2...

result:

ok Correct (2277 test cases)

Test #6:

score: 0
Accepted
time: 12ms
memory: 3788kb

input:

2095
43 903
43 836
43 288
43 362
44 461
44 748
43 360
45 160
45 111
44 696
43 518
43 441
43 636
43 853
44 594
43 23
43 540
44 167
44 735
43 317
43 127
44 795
43 347
43 445
44 388
43 880
44 177
43 744
43 131
44 208
43 521
43 342
45 128
44 908
43 843
45 36
43 404
43 311
43 185
44 727
44 599
43 375
43 ...

output:

NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 28 24 30 26 32 29 34 31 36 33 38 35 40 37 41 39 27 43 42 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 20 18 21 22 23 24 25 26 27 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 
YES
1 2 3 4 5 6 7 8 9 11 12 10 13 14 15 16 17 1...

result:

ok Correct (2095 test cases)

Test #7:

score: 0
Accepted
time: 7ms
memory: 3812kb

input:

1932
45 489
46 403
45 883
46 531
45 906
45 54
45 320
45 410
45 425
45 719
45 342
46 628
46 508
45 950
45 825
46 309
46 687
46 164
46 284
46 634
45 87
45 836
46 719
46 313
45 687
45 602
45 773
46 629
46 301
46 219
45 59
46 670
46 58
45 538
46 33
45 229
45 919
45 805
46 107
45 971
46 335
45 555
45 552...

output:

YES
1 2 3 4 6 7 5 8 9 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 
YES
1 2 3 4 6 7 5 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 1...

result:

ok Correct (1932 test cases)

Test #8:

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

input:

1585
50 173
50 325
51 176
50 136
51 211
50 766
51 203
51 107
51 145
50 990
50 1054
50 542
50 135
51 234
51 302
50 346
50 1051
50 733
51 27
50 559
50 967
50 38
50 861
50 832
50 83
50 551
51 33
51 332
50 977
50 466
51 146
50 912
51 312
50 256
50 891
50 1076
51 319
50 710
50 269
50 689
51 143
50 259
50...

output:

YES
1 2 3 4 5 6 7 8 9 10 12 13 11 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 46 45 48 47 50 49 
YES
1 2 3 4 5 6 7 8 9 10 12 13 11 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 37 40 39 42 41 44 43 46 45 48 47 50 49 
YES
1 2 ...

result:

ok Correct (1585 test cases)

Test #9:

score: 0
Accepted
time: 9ms
memory: 3576kb

input:

1422
53 964
53 573
53 593
53 923
53 901
53 1244
53 29
54 2
53 544
53 89
53 229
53 304
53 1035
53 1002
53 184
53 951
53 1123
53 1167
53 32
53 1342
53 1037
53 1280
53 943
53 850
53 309
53 925
53 587
53 238
53 714
53 872
53 52
54 24
53 233
53 908
53 672
53 1286
53 910
54 21
53 407
53 106
53 555
53 764
...

output:

YES
3 1 5 2 7 4 9 6 11 8 14 10 16 12 18 15 20 17 22 19 24 21 26 23 28 25 30 27 32 29 34 31 35 33 13 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 
YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 21 19 22 23 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 ...

result:

ok Correct (1422 test cases)

Test #10:

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

input:

400
100 221
100 321
100 334
100 1
100 17
100 166
100 312
100 186
100 343
100 39
100 206
100 288
100 134
100 127
100 159
100 307
100 105
100 160
100 213
100 319
100 337
100 264
100 181
100 115
100 267
100 308
100 171
100 192
100 140
100 309
100 189
100 20
100 350
100 130
100 376
100 246
100 165
100 3...

output:

YES
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 70 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 98 97 100 99 
YES...

result:

ok Correct (400 test cases)

Test #11:

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

input:

1078
53 1368
56 1539
56 1510
52 1326
51 1234
65 2063
60 1740
60 1751
53 1355
69 2337
70 2415
61 1797
52 1325
61 1796
59 1669
57 1567
70 2412
65 2030
68 2271
61 1814
69 2314
50 1219
67 2182
66 2141
51 1268
61 1806
62 1865
68 2231
69 2324
59 1703
66 2128
68 2246
64 2007
55 1463
68 2225
71 2451
71 2436...

output:

NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 54 50 55 53 56 52 
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 18 14 20 16 22 19 24 21 26 23 28 25 30 27 32 29 34 31 36 33 38 35 40 37 42 39 44 41 46 43 ...

result:

ok Correct (1078 test cases)

Test #12:

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

input:

683
77 2903
77 2909
73 2616
73 2626
80 3140
79 3065
79 3046
77 2895
78 2968
82 3273
82 3298
79 3058
82 3265
76 2830
81 3236
72 2518
79 3068
79 3056
76 2800
82 3270
73 2577
78 3001
80 3134
78 2994
72 2546
79 3038
76 2796
78 2991
82 3267
74 2651
79 3080
71 2477
78 2971
77 2901
79 3077
75 2723
82 3299
...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 70 66 72 69 74 71 76 73 78 75 80 77 81 79 82 68 
NO
NO
YES
3 1 5 2 7 4 9 6 11 8 ...

result:

ok Correct (683 test cases)

Test #13:

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

input:

542
88 3815
83 3358
89 3864
86 3595
90 3962
84 3439
89 3879
90 3949
83 3394
86 3615
87 3706
87 3739
84 3427
88 3812
88 3774
86 3649
82 3289
82 3311
85 3518
85 3512
89 3873
83 3363
86 3600
88 3795
89 3862
83 3356
88 3781
90 3942
89 3878
85 3552
83 3391
82 3294
85 3535
86 3601
84 3455
85 3533
87 3700
...

output:

NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 74 70 76 72 78 75 80 77 82 79 83 81 73 
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 ...

result:

ok Correct (542 test cases)

Test #14:

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

input:

462
90 3942
92 4165
90 3961
95 4435
90 3989
92 4166
91 4082
93 4259
95 4441
96 4554
91 4058
95 4463
93 4271
96 4521
96 4507
94 4360
96 4518
95 4433
94 4354
92 4144
95 4407
96 4500
95 4442
93 4266
92 4183
96 4514
91 4072
91 4043
91 4050
92 4122
95 4453
95 4412
91 4088
93 4233
95 4437
96 4529
94 4340
...

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 56 52 58 55 60 57 62 59 64 61 66 63 68 65 70 67 72 69 74 71 76 73 78 75 80 77 82 79 84 81 86 83 88 85 89 87 90 54 
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 ...

result:

ok Correct (462 test cases)

Test #15:

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

input:

412
96 4543
100 4908
100 4906
99 4838
98 4693
96 4507
101 5036
100 4886
97 4622
97 4640
97 4590
98 4732
97 4648
97 4607
99 4846
99 4800
100 4919
100 4887
100 4940
99 4816
97 4631
100 4892
98 4741
96 4547
99 4786
99 4849
97 4621
97 4609
98 4687
100 4903
98 4748
99 4830
96 4553
96 4504
97 4629
97 4642...

output:

NO
NO
NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 78 74 80 77 82 79 84 81 86 83 88 85 90 87 92 89 94 91 96 93 97 95 98 76...

result:

ok Correct (412 test cases)

Test #16:

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

input:

375
104 5315
102 5092
101 5042
101 4989
104 5328
104 5300
103 5248
106 5503
102 5119
102 5134
102 5141
103 5196
103 5247
104 5302
102 5086
105 5392
101 4996
104 5335
104 5327
101 4982
104 5348
101 5041
106 5504
105 5412
105 5395
102 5136
103 5217
105 5435
103 5188
103 5229
102 5091
104 5333
102 5114...

output:

NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 88 84 90 87 92 89 94 91 96 93 98 95 100 97 101 99 ...

result:

ok Correct (375 test cases)

Test #17:

score: 0
Accepted
time: 18ms
memory: 3612kb

input:

9156
15 93
28 362
30 431
22 176
30 431
17 121
12 66
20 173
23 247
10 40
14 80
27 341
21 207
21 25
25 292
23 240
10 23
20 184
17 14
12 34
12 58
26 324
23 139
11 53
15 89
26 321
28 357
24 93
11 51
23 246
13 68
25 282
28 367
23 237
17 120
24 258
30 237
19 170
20 181
27 337
23 245
17 123
23 249
12 34
23...

output:

YES
4 2 6 3 8 5 10 7 12 9 14 11 15 13 1 
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 26 22 27 25 28 24 
NO
YES
4 2 6 3 8 5 10 7 12 9 14 11 16 13 17 15 18 1 20 19 22 21 
NO
YES
3 1 6 2 8 5 10 7 12 9 14 11 16 13 17 15 4 
NO
YES
3 1 5 2 8 4 10 7 12 9 14 11 16 13 18 15 19 17 20 6 
NO
YE...

result:

ok Correct (9156 test cases)

Test #18:

score: 0
Accepted
time: 12ms
memory: 3524kb

input:

1560
58 1629
41 812
47 1052
58 1617
59 718
56 1538
59 1678
45 961
47 1061
47 1048
45 968
46 792
52 993
44 793
60 1760
53 1352
41 152
53 1349
46 9
47 1050
52 897
48 74
49 1154
55 490
60 910
44 929
46 1010
57 1594
56 1503
43 896
41 807
46 1011
42 339
54 898
51 1259
51 1250
53 1366
49 1162
59 1692
57 1...

output:

NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 34 30 36 32 38 35 40 37 42 39 44 41 46 43 47 45 33 
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 46 42 48 45 50 47 52 49 54 51 56 53 ...

result:

ok Correct (1560 test cases)

Test #19:

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

input:

394
97 4606
92 2317
101 1713
95 450
101 4990
107 624
101 5044
106 5518
96 4512
106 5504
108 2743
104 5299
94 4316
101 351
104 3142
108 5757
102 5124
94 4321
108 4240
105 5425
90 3955
100 4903
106 2385
104 5337
96 4505
99 4838
97 4652
92 4171
100 4892
110 4994
110 747
98 4718
94 2159
105 2314
94 4343...

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 92 88 94 90 96 93 97 95 91 
YES
3 1 5 2 7...

result:

ok Correct (394 test cases)

Test #20:

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

input:

99
210 9276
194 18622
201 20031
203 3130
198 19422
208 21421
206 9196
193 18498
206 11194
199 5647
203 20420
210 21831
202 20196
197 19198
202 20206
195 18812
192 18333
198 19459
202 511
194 18637
200 13168
208 15719
200 2279
203 16405
197 19198
204 20604
191 18132
190 17894
209 16449
191 10417
209 ...

output:

YES
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 68 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 ...

result:

ok Correct (99 test cases)

Test #21:

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

input:

44
301 44995
295 43213
305 46241
310 2815
300 13643
297 43917
302 38708
305 2407
302 45409
300 44710
305 46199
298 38380
293 42668
299 44402
297 43920
303 45636
295 43239
301 45092
299 44477
295 43217
310 30914
296 43508
291 42168
290 3004
303 11092
301 45111
310 9447
292 11065
302 45301
294 42917
3...

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (44 test cases)

Test #22:

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

input:

25
393 24865
409 83229
409 83228
397 78466
397 78497
398 78795
406 28894
405 81636
398 78818
398 78811
399 79193
391 76050
401 36783
392 76615
391 76045
410 83631
403 44100
404 10805
392 76436
400 79791
403 80797
400 59101
390 75675
397 22854
392 76435

output:

YES
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 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 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok Correct (25 test cases)

Test #23:

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

input:

15
509 129152
490 119746
492 120563
501 125131
504 93193
508 100551
494 121519
500 124497
503 126000
491 1479
506 127718
505 127003
505 127085
498 123702
510 129719

output:

NO
NO
NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96...

result:

ok Correct (15 test cases)

Test #24:

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

input:

11
608 169179
599 5916
600 31395
608 18910
601 180167
605 182399
603 181198
591 60281
595 176408
609 185083
596 177270

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (11 test cases)

Test #25:

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

input:

8
696 241511
701 129166
700 52365
695 240810
690 235929
694 240313
691 238246
704 247218

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (8 test cases)

Test #26:

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

input:

6
791 312045
802 247610
804 322553
806 324256
796 316408
791 95268

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (6 test cases)

Test #27:

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

input:

4
903 407183
895 399696
908 411720
893 397825

output:

NO
NO
NO
YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 10...

result:

ok Correct (4 test cases)

Test #28:

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

input:

4
958 458261
945 445705
945 144602
958 457928

output:

NO
NO
YES
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 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 90 91 92 93 94 95 96 97 98 99 10...

result:

ok Correct (4 test cases)

Test #29:

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

input:

4
984 350686
983 88304
974 473788
981 480195

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (4 test cases)

Test #30:

score: 0
Accepted
time: 11ms
memory: 4548kb

input:

4
997 495998
994 493016
996 302206
991 490041

output:

YES
3 1 5 2 7 4 9 6 11 8 13 10 15 12 17 14 19 16 21 18 23 20 25 22 27 24 29 26 31 28 33 30 35 32 37 34 39 36 41 38 43 40 45 42 47 44 49 46 51 48 53 50 55 52 57 54 59 56 61 58 63 60 65 62 67 64 69 66 71 68 73 70 75 72 77 74 79 76 81 78 83 80 85 82 87 84 89 86 91 88 93 90 95 92 97 94 99 96 101 98 103 ...

result:

ok Correct (4 test cases)