QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#353627#8328. A Good Problemucup-team004#AC ✓3ms3920kbC++20939b2024-03-14 13:38:182024-03-14 13:38:19

Judging History

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

  • [2024-03-14 13:38:19]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3920kb
  • [2024-03-14 13:38:18]
  • 提交

answer

#include <bits/stdc++.h>

using i64 = long long;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    int n;
    std::cin >> n;
    
    std::vector<int> b(n);
    for (int i = 0; i < n; i++) {
        std::cin >> b[i];
    }

    std::vector<std::pair<int, int>> ans;
    auto work = [&](auto self, int l, int r) -> void {
        if (r - l == 1) {
            return;
        }
        int m = (l + r) / 2;
        for (int i = 0; i < n; i++) {
            if (m <= b[i] && b[i] < r) {
                ans.emplace_back(2, i + 1);
            }
        }
        for (int i = l + 1; i < m; i++) {
            ans.emplace_back(1, i);
        }
        self(self, l, m);
        self(self, m, r);
    };
    work(work, 0, n + 1);

    std::cout << ans.size() << "\n";
    for (auto [x, y] : ans) {
        std::cout << x << " " << y << "\n";
    }

    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
2 4 3 1

output:

8
2 1
2 2
2 3
1 1
2 4
2 2
2 3
2 2

result:

ok Correct!

Test #2:

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

input:

10
4 3 7 3 6 6 10 0 10 9

output:

32
2 3
2 5
2 6
2 7
2 9
2 10
1 1
1 2
1 3
1 4
2 1
2 2
2 4
1 1
2 1
2 2
2 4
2 1
2 7
2 9
2 10
1 6
1 7
2 3
2 5
2 6
2 3
2 7
2 9
2 10
2 7
2 9

result:

ok Correct!

Test #3:

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

input:

10
6 3 3 9 1 2 4 6 9 7

output:

29
2 1
2 4
2 8
2 9
2 10
1 1
1 2
1 3
1 4
2 2
2 3
2 6
2 7
1 1
2 5
2 2
2 3
2 7
2 7
2 4
2 9
1 6
1 7
2 1
2 8
2 10
2 10
2 4
2 9

result:

ok Correct!

Test #4:

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

input:

10
2 9 4 6 8 10 6 9 7 7

output:

33
2 2
2 4
2 5
2 6
2 7
2 8
2 9
2 10
1 1
1 2
1 3
1 4
2 1
2 3
1 1
2 3
2 3
2 2
2 5
2 6
2 8
1 6
1 7
2 4
2 7
2 9
2 10
2 9
2 10
2 2
2 6
2 8
2 6

result:

ok Correct!

Test #5:

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

input:

10
1 2 4 7 3 1 3 6 9 1

output:

26
2 4
2 8
2 9
1 1
1 2
1 3
1 4
2 2
2 3
2 5
2 7
1 1
2 1
2 6
2 10
2 3
2 5
2 7
2 3
2 9
1 6
1 7
2 4
2 8
2 4
2 9

result:

ok Correct!

Test #6:

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

input:

10
4 4 8 3 6 1 2 3 2 3

output:

26
2 3
2 5
1 1
1 2
1 3
1 4
2 1
2 2
2 4
2 7
2 8
2 9
2 10
1 1
2 6
2 1
2 2
2 4
2 8
2 10
2 1
2 2
2 3
1 6
1 7
2 5

result:

ok Correct!

Test #7:

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

input:

10
4 3 1 8 4 6 1 1 2 8

output:

25
2 4
2 6
2 10
1 1
1 2
1 3
1 4
2 1
2 2
2 5
2 9
1 1
2 3
2 7
2 8
2 1
2 2
2 5
2 1
2 5
2 4
2 10
1 6
1 7
2 6

result:

ok Correct!

Test #8:

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

input:

100
13 66 98 73 11 2 65 56 61 30 91 83 90 84 64 44 22 21 93 7 41 46 41 18 13 23 80 20 45 32 54 35 90 52 7 44 4 8 38 13 67 14 5 35 70 15 30 72 58 31 36 40 32 43 52 76 78 27 43 42 80 78 64 43 10 23 61 2 3 19 4 47 76 79 10 89 83 9 40 37 36 35 79 19 46 24 23 5 1 100 22 55 37 24 74 75 31 48 79 87

output:

582
2 2
2 3
2 4
2 7
2 8
2 9
2 11
2 12
2 13
2 14
2 15
2 19
2 27
2 31
2 33
2 34
2 41
2 45
2 48
2 49
2 55
2 56
2 57
2 61
2 62
2 63
2 67
2 73
2 74
2 76
2 77
2 83
2 90
2 92
2 95
2 96
2 99
2 100
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
...

result:

ok Correct!

Test #9:

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

input:

100
12 84 19 6 50 64 72 49 6 11 62 23 35 54 41 68 77 16 88 11 19 52 25 7 79 27 68 42 86 74 25 40 44 5 30 95 36 18 83 23 47 86 69 18 100 52 0 21 94 2 92 68 23 44 41 6 17 50 93 13 30 25 66 59 21 63 7 82 51 20 70 29 99 76 50 88 54 5 26 28 10 100 92 79 55 57 92 21 55 59 82 60 49 22 13 14 69 62 13 12

output:

557
2 2
2 5
2 6
2 7
2 11
2 14
2 16
2 17
2 19
2 22
2 25
2 27
2 29
2 30
2 36
2 39
2 42
2 43
2 45
2 46
2 49
2 51
2 52
2 58
2 59
2 63
2 64
2 66
2 68
2 69
2 71
2 73
2 74
2 75
2 76
2 77
2 82
2 83
2 84
2 85
2 86
2 87
2 89
2 90
2 91
2 92
2 97
2 98
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14...

result:

ok Correct!

Test #10:

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

input:

100
57 58 65 22 1 8 7 53 29 91 39 85 30 88 54 11 46 12 0 85 86 80 17 59 13 86 39 89 13 48 21 45 45 61 49 60 3 31 73 94 31 44 25 87 8 35 83 38 69 73 0 51 86 68 71 70 23 12 97 70 12 28 77 42 93 55 13 85 42 42 52 94 24 0 1 6 14 37 66 41 98 49 82 46 36 10 30 98 56 98 38 73 45 17 6 99 18 90 99 39

output:

584
2 1
2 2
2 3
2 8
2 10
2 12
2 14
2 15
2 20
2 21
2 22
2 24
2 26
2 28
2 34
2 36
2 39
2 40
2 44
2 47
2 49
2 50
2 52
2 53
2 54
2 55
2 56
2 59
2 60
2 63
2 65
2 66
2 68
2 71
2 72
2 79
2 81
2 83
2 88
2 89
2 90
2 92
2 96
2 98
2 99
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17...

result:

ok Correct!

Test #11:

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

input:

100
12 22 7 50 1 15 38 89 24 39 35 2 98 7 35 40 27 8 43 35 40 51 1 13 13 57 44 5 39 69 81 77 71 28 49 9 21 51 14 22 29 33 18 3 1 86 60 27 67 64 11 22 5 28 35 36 73 52 8 30 86 79 68 53 31 51 14 28 11 3 79 77 31 16 16 48 4 46 72 49 28 17 71 12 61 32 20 27 31 64 75 57 67 21 24 15 74 30 12 12

output:

540
2 4
2 8
2 13
2 22
2 26
2 30
2 31
2 32
2 33
2 38
2 46
2 47
2 49
2 50
2 57
2 58
2 61
2 62
2 63
2 64
2 66
2 71
2 72
2 79
2 83
2 85
2 90
2 91
2 92
2 93
2 97
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 ...

result:

ok Correct!

Test #12:

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

input:

100
28 27 6 9 3 30 63 2 65 50 26 3 77 35 16 14 53 37 26 8 9 60 51 40 10 49 29 13 33 15 35 15 2 24 44 57 42 34 27 54 3 63 53 73 23 36 39 28 86 69 68 41 15 18 24 89 29 47 56 28 14 32 78 11 29 11 59 47 11 25 80 50 30 37 6 61 90 49 27 19 29 46 24 1 32 73 4 28 42 23 3 34 6 12 52 69 7 34 52 15

output:

524
2 7
2 9
2 10
2 13
2 17
2 22
2 23
2 36
2 40
2 42
2 43
2 44
2 49
2 50
2 51
2 56
2 59
2 63
2 67
2 71
2 72
2 76
2 77
2 86
2 95
2 96
2 99
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 ...

result:

ok Correct!

Test #13:

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

input:

100
25 7 7 9 34 58 34 36 49 6 10 34 22 40 24 17 9 90 54 2 38 67 59 74 31 8 34 15 12 55 12 45 4 19 4 19 28 40 92 4 4 22 21 2 39 71 65 77 11 13 9 37 72 32 21 16 23 39 23 66 16 28 13 41 12 45 66 13 49 45 43 34 16 84 6 6 81 22 4 23 35 3 69 14 15 33 8 71 26 52 9 20 9 46 68 74 50 21 23 35

output:

533
2 6
2 18
2 19
2 22
2 23
2 24
2 30
2 39
2 46
2 47
2 48
2 53
2 60
2 67
2 74
2 77
2 83
2 88
2 90
2 95
2 96
2 97
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1...

result:

ok Correct!

Test #14:

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

input:

1000
34 769 740 957 126 724 943 359 299 576 260 460 760 303 348 482 42 335 484 573 302 717 25 356 310 296 235 487 342 362 379 778 964 875 655 60 13 422 136 964 240 675 262 628 805 953 686 20 305 888 982 688 366 105 508 252 971 419 715 945 910 343 835 926 63 59 441 335 322 56 75 335 128 514 839 424 1...

output:

9033
2 2
2 3
2 4
2 6
2 7
2 10
2 13
2 20
2 22
2 32
2 33
2 34
2 35
2 40
2 42
2 44
2 45
2 46
2 47
2 50
2 51
2 52
2 55
2 57
2 59
2 60
2 61
2 63
2 64
2 74
2 75
2 78
2 80
2 84
2 87
2 88
2 96
2 99
2 100
2 102
2 103
2 104
2 105
2 106
2 107
2 111
2 113
2 114
2 115
2 116
2 117
2 118
2 119
2 123
2 125
2 126
2 ...

result:

ok Correct!

Test #15:

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

input:

1000
668 960 321 884 19 156 939 362 0 202 59 402 991 327 654 803 893 662 85 825 342 200 91 867 199 649 117 64 242 668 887 663 843 105 823 639 904 992 670 315 100 941 662 237 879 900 603 575 240 532 573 310 264 442 925 924 244 634 88 635 685 180 235 178 699 356 366 623 137 24 810 783 174 553 4 767 66...

output:

9010
2 1
2 2
2 4
2 7
2 13
2 15
2 16
2 17
2 18
2 20
2 24
2 26
2 30
2 31
2 32
2 33
2 35
2 36
2 37
2 38
2 39
2 42
2 43
2 45
2 46
2 47
2 48
2 50
2 51
2 55
2 56
2 58
2 60
2 61
2 65
2 68
2 71
2 72
2 74
2 76
2 77
2 82
2 87
2 92
2 93
2 94
2 98
2 100
2 103
2 106
2 108
2 110
2 111
2 112
2 115
2 117
2 118
2 11...

result:

ok Correct!

Test #16:

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

input:

1000
969 408 165 253 331 421 61 882 701 103 489 555 712 547 769 3 619 952 972 451 564 413 293 173 488 217 689 167 114 562 419 638 340 527 348 288 785 610 769 142 753 91 36 215 576 442 762 853 20 911 843 117 741 949 209 694 126 695 389 365 92 657 663 304 277 476 692 87 315 199 33 926 232 514 714 254 ...

output:

9021
2 1
2 8
2 9
2 12
2 13
2 14
2 15
2 17
2 18
2 19
2 21
2 27
2 30
2 32
2 34
2 37
2 38
2 39
2 41
2 45
2 47
2 48
2 50
2 51
2 53
2 54
2 56
2 58
2 62
2 63
2 67
2 72
2 74
2 75
2 77
2 79
2 82
2 88
2 90
2 91
2 92
2 94
2 97
2 98
2 100
2 101
2 104
2 105
2 106
2 107
2 108
2 112
2 113
2 117
2 120
2 122
2 123
...

result:

ok Correct!

Test #17:

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

input:

1000
203 307 134 54 891 392 567 161 179 563 175 184 863 89 54 537 563 34 97 207 517 286 750 517 195 63 477 468 168 863 338 193 455 120 60 584 135 197 159 667 834 154 533 191 392 142 715 218 96 609 25 492 295 57 347 263 289 359 290 617 146 616 111 528 179 714 910 233 180 251 134 692 365 78 157 386 26...

output:

8474
2 5
2 7
2 10
2 13
2 16
2 17
2 21
2 23
2 24
2 30
2 36
2 40
2 41
2 43
2 47
2 50
2 60
2 62
2 64
2 66
2 67
2 72
2 79
2 80
2 81
2 87
2 90
2 94
2 96
2 97
2 98
2 99
2 102
2 103
2 122
2 124
2 129
2 136
2 141
2 142
2 147
2 149
2 151
2 158
2 159
2 160
2 170
2 173
2 179
2 182
2 183
2 185
2 188
2 193
2 196...

result:

ok Correct!

Test #18:

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

input:

1000
359 29 135 514 371 700 67 651 167 555 476 413 215 19 110 225 289 13 46 616 762 42 547 218 26 573 674 109 454 894 215 591 42 13 361 304 128 201 576 392 54 111 425 119 344 260 252 484 51 492 572 207 372 183 745 560 684 294 270 97 278 38 223 282 120 273 630 294 625 752 818 203 417 113 191 811 902 ...

output:

8464
2 4
2 6
2 8
2 10
2 20
2 21
2 23
2 26
2 27
2 30
2 32
2 39
2 51
2 55
2 56
2 57
2 67
2 69
2 70
2 71
2 76
2 77
2 79
2 80
2 92
2 107
2 113
2 116
2 117
2 125
2 127
2 128
2 129
2 131
2 132
2 138
2 142
2 144
2 145
2 147
2 148
2 151
2 157
2 158
2 165
2 172
2 177
2 182
2 187
2 188
2 191
2 193
2 196
2 210...

result:

ok Correct!

Test #19:

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

input:

1000
672 331 438 653 624 242 641 619 51 548 649 796 172 324 106 792 16 147 307 248 86 699 223 11 633 239 340 473 526 145 25 83 13 586 329 97 494 63 279 119 158 103 7 411 44 123 520 597 546 182 90 558 79 1 765 330 285 278 137 464 15 676 171 224 569 493 578 508 206 286 132 41 2 628 93 111 305 15 215 3...

output:

8511
2 1
2 4
2 5
2 7
2 8
2 10
2 11
2 12
2 16
2 22
2 25
2 29
2 34
2 47
2 48
2 49
2 52
2 55
2 62
2 65
2 67
2 68
2 74
2 84
2 88
2 94
2 99
2 102
2 107
2 110
2 121
2 123
2 124
2 129
2 130
2 132
2 135
2 140
2 142
2 143
2 144
2 145
2 146
2 150
2 154
2 155
2 160
2 170
2 173
2 175
2 176
2 177
2 178
2 180
2 1...

result:

ok Correct!

Test #20:

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

input:

1000
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...

output:

8987
2 500
2 501
2 502
2 503
2 504
2 505
2 506
2 507
2 508
2 509
2 510
2 511
2 512
2 513
2 514
2 515
2 516
2 517
2 518
2 519
2 520
2 521
2 522
2 523
2 524
2 525
2 526
2 527
2 528
2 529
2 530
2 531
2 532
2 533
2 534
2 535
2 536
2 537
2 538
2 539
2 540
2 541
2 542
2 543
2 544
2 545
2 546
2 547
2 548
2...

result:

ok Correct!

Test #21:

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

input:

1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

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

result:

ok Correct!

Test #22:

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

input:

1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

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

result:

ok Correct!

Extra Test:

score: 0
Extra Test Passed