QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656367 | #8328. A Good Problem | daoqi# | AC ✓ | 1ms | 3884kb | C++20 | 1.2kb | 2024-10-19 12:38:35 | 2024-10-19 12:38:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e3 + 10;
vector<int> v[N];
vector<pair<int, int>> ans;
void dfs(int l, int r, int now) {
if (l == r) {
if (v[l].size() == 0) return;
for (int i = now; i < r; i++) {
ans.push_back({1, i});
}
return;
}
bool flag = false;
int mid = l + r >> 1;
for (int i = mid + 1; i <= r; i++) {
if (v[i].size() == 0) continue;
flag = true;
for (auto it: v[i]) ans.push_back({2, it});
}
if (flag) {
for (int i = now + 1; i <= mid; i++) {
ans.push_back({1, i});
}
}
dfs(l, mid, now);
dfs(mid + 1, r, mid + 1);
}
void solve() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
v[x].push_back(i);
}
dfs(0, n, 0);
cout << ans.size() << endl;
for (auto &[op, x]: ans) {
cout << op << ' ' << x << '\n';
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 1;
// cin >> T;
cout << fixed << setprecision(20);
while (T--) {
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3656kb
input:
4 2 4 3 1
output:
8 2 3 2 2 1 1 1 2 2 1 1 1 2 4 2 2
result:
ok Correct!
Test #2:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 4 3 7 3 6 6 10 0 10 9
output:
25 2 5 2 6 2 3 2 10 2 7 2 9 1 1 1 2 1 3 1 4 1 5 2 2 2 4 2 1 1 1 1 2 2 1 2 10 2 7 2 9 1 7 1 8 2 3 2 7 2 9
result:
ok Correct!
Test #3:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
10 6 3 3 9 1 2 4 6 9 7
output:
24 2 1 2 8 2 10 2 4 2 9 1 1 1 2 1 3 1 4 1 5 2 2 2 3 2 7 1 1 1 2 2 6 1 1 2 5 2 7 2 4 2 9 1 7 1 8 2 10
result:
ok Correct!
Test #4:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
10 2 9 4 6 8 10 6 9 7 7
output:
29 2 4 2 7 2 9 2 10 2 5 2 2 2 8 2 6 1 1 1 2 1 3 1 4 1 5 2 3 1 1 1 2 2 1 1 1 2 3 2 2 2 8 2 6 1 7 1 8 2 5 1 7 2 9 2 10 2 6
result:
ok Correct!
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 1 2 4 7 3 1 3 6 9 1
output:
23 2 8 2 4 2 9 1 1 1 2 1 3 1 4 1 5 2 5 2 7 2 3 1 1 1 2 2 2 1 1 2 1 2 6 2 10 2 3 2 9 1 7 1 8 2 4
result:
ok Correct!
Test #6:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 4 4 8 3 6 1 2 3 2 3
output:
22 2 5 2 3 1 1 1 2 1 3 1 4 1 5 2 4 2 8 2 10 2 1 2 2 1 1 1 2 2 7 2 9 1 1 2 6 2 1 2 2 2 3 1 7
result:
ok Correct!
Test #7:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10 4 3 1 8 4 6 1 1 2 8
output:
23 2 6 2 4 2 10 1 1 1 2 1 3 1 4 1 5 2 2 2 1 2 5 1 1 1 2 2 9 1 1 2 3 2 7 2 8 2 1 2 5 2 4 2 10 1 7
result:
ok Correct!
Test #8:
score: 0
Accepted
time: 0ms
memory: 3672kb
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:
542 2 34 2 55 2 31 2 92 2 8 2 49 2 9 2 67 2 15 2 63 2 7 2 2 2 41 2 45 2 48 2 4 2 95 2 96 2 56 2 73 2 57 2 62 2 74 2 83 2 99 2 27 2 61 2 12 2 77 2 14 2 100 2 76 2 13 2 33 2 11 2 19 2 3 2 90 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: 0ms
memory: 3612kb
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:
571 2 69 2 22 2 46 2 14 2 77 2 85 2 89 2 86 2 64 2 90 2 92 2 11 2 98 2 66 2 6 2 63 2 16 2 27 2 52 2 43 2 97 2 71 2 7 2 30 2 74 2 17 2 25 2 84 2 68 2 91 2 39 2 2 2 29 2 42 2 19 2 76 2 51 2 83 2 87 2 59 2 49 2 36 2 73 2 45 2 82 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 1...
result:
ok Correct!
Test #10:
score: 0
Accepted
time: 0ms
memory: 3728kb
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:
560 2 52 2 71 2 8 2 15 2 66 2 89 2 1 2 2 2 24 2 36 2 34 2 3 2 79 2 54 2 49 2 56 2 60 2 55 2 39 2 50 2 92 2 63 2 22 2 83 2 47 2 12 2 20 2 68 2 21 2 26 2 53 2 44 2 14 2 28 2 98 2 10 2 65 2 40 2 72 2 59 2 81 2 88 2 90 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...
result:
ok Correct!
Test #11:
score: 0
Accepted
time: 0ms
memory: 3616kb
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:
522 2 22 2 38 2 66 2 58 2 64 2 26 2 92 2 47 2 85 2 50 2 90 2 49 2 93 2 63 2 30 2 33 2 83 2 79 2 57 2 97 2 91 2 32 2 72 2 62 2 71 2 31 2 46 2 61 2 8 2 13 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...
result:
ok Correct!
Test #12:
score: 0
Accepted
time: 0ms
memory: 3656kb
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:
517 2 23 2 95 2 99 2 17 2 43 2 40 2 59 2 36 2 67 2 22 2 76 2 7 2 42 2 9 2 51 2 50 2 96 2 44 2 86 2 13 2 63 2 71 2 49 2 56 2 77 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 ...
result:
ok Correct!
Test #13:
score: 0
Accepted
time: 0ms
memory: 3668kb
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:
510 2 90 2 19 2 30 2 6 2 23 2 47 2 60 2 67 2 22 2 95 2 83 2 46 2 88 2 53 2 24 2 96 2 48 2 77 2 74 2 18 2 39 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...
result:
ok Correct!
Test #14:
score: 0
Accepted
time: 1ms
memory: 3828kb
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:
8878 2 103 2 179 2 189 2 831 2 140 2 516 2 875 2 750 2 55 2 490 2 587 2 683 2 834 2 964 2 74 2 104 2 138 2 778 2 967 2 995 2 387 2 669 2 318 2 327 2 697 2 701 2 294 2 589 2 729 2 229 2 307 2 665 2 993 2 439 2 209 2 643 2 679 2 115 2 398 2 791 2 243 2 676 2 857 2 211 2 710 2 552 2 127 2 163 2 114 2 4...
result:
ok Correct!
Test #15:
score: 0
Accepted
time: 1ms
memory: 3768kb
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:
8961 2 852 2 117 2 334 2 474 2 317 2 425 2 168 2 740 2 925 2 178 2 468 2 473 2 688 2 525 2 729 2 706 2 378 2 769 2 263 2 671 2 713 2 986 2 299 2 204 2 50 2 248 2 631 2 82 2 965 2 904 2 844 2 881 2 536 2 373 2 702 2 760 2 726 2 814 2 839 2 532 2 438 2 786 2 618 2 74 2 207 2 847 2 294 2 484 2 709 2 55...
result:
ok Correct!
Test #16:
score: 0
Accepted
time: 1ms
memory: 3884kb
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:
8934 2 613 2 482 2 801 2 221 2 230 2 847 2 935 2 240 2 618 2 74 2 396 2 212 2 520 2 251 2 919 2 288 2 723 2 807 2 442 2 921 2 413 2 949 2 34 2 397 2 922 2 509 2 346 2 360 2 192 2 879 2 590 2 854 2 322 2 692 2 933 2 356 2 969 2 224 2 650 2 956 2 14 2 487 2 542 2 804 2 226 2 571 2 282 2 638 2 336 2 44...
result:
ok Correct!
Test #17:
score: 0
Accepted
time: 1ms
memory: 3836kb
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:
8277 2 136 2 81 2 848 2 909 2 491 2 796 2 325 2 780 2 160 2 405 2 746 2 147 2 816 2 99 2 494 2 927 2 460 2 285 2 21 2 24 2 98 2 689 2 884 2 999 2 223 2 683 2 793 2 732 2 320 2 703 2 64 2 183 2 635 2 360 2 908 2 859 2 43 2 288 2 213 2 609 2 87 2 16 2 788 2 404 2 956 2 730 2 342 2 913 2 537 2 141 2 38...
result:
ok Correct!
Test #18:
score: 0
Accepted
time: 0ms
memory: 3824kb
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:
8177 2 541 2 80 2 374 2 387 2 896 2 663 2 306 2 847 2 661 2 695 2 344 2 946 2 117 2 508 2 4 2 886 2 157 2 188 2 296 2 981 2 522 2 516 2 530 2 128 2 138 2 378 2 270 2 445 2 247 2 995 2 551 2 244 2 492 2 412 2 107 2 837 2 688 2 876 2 900 2 23 2 147 2 316 2 953 2 386 2 519 2 132 2 254 2 431 2 10 2 623 ...
result:
ok Correct!
Test #19:
score: 0
Accepted
time: 1ms
memory: 3856kb
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:
8417 2 608 2 896 2 259 2 953 2 135 2 300 2 765 2 68 2 861 2 170 2 816 2 180 2 535 2 223 2 528 2 632 2 668 2 972 2 671 2 936 2 383 2 981 2 766 2 369 2 47 2 220 2 264 2 573 2 793 2 146 2 29 2 549 2 940 2 945 2 605 2 662 2 424 2 532 2 912 2 392 2 236 2 320 2 287 2 562 2 99 2 186 2 619 2 968 2 49 2 229 ...
result:
ok Correct!
Test #20:
score: 0
Accepted
time: 1ms
memory: 3792kb
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 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 549 2...
result:
ok Correct!
Test #21:
score: 0
Accepted
time: 1ms
memory: 3848kb
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:
9991 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 61...
result:
ok Correct!
Test #22:
score: 0
Accepted
time: 0ms
memory: 3596kb
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:
0
result:
ok Correct!
Extra Test:
score: 0
Extra Test Passed