QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#436770 | #8783. Cherry Picking | ucup-team3695# | AC ✓ | 26ms | 11592kb | C++20 | 1.6kb | 2024-06-09 03:02:22 | 2024-06-09 03:02:23 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define MAXN 100'010
int n, k;
vi a;
vi vals;
string b;
int par[MAXN];
int csz[MAXN];
int getPar(int x) {
if (par[x] == x) return x;
return par[x] = getPar(par[x]);
}
void Union(int x, int y) {
if (getPar(x) == getPar(y)) return;
csz[getPar(y)] += csz[getPar(x)];
par[getPar(x)] = getPar(y);
}
vi hasval[MAXN];
int main() {
cin.tie(0)->sync_with_stdio(0);
cin.exceptions(cin.failbit);
cin >> n >> k;
a.resize(n);
rep(i, 0, n) cin >> a[i];
cin >> b;
n++;
a.pb(100000);
b.pb('0');
rep(i, 0, n) {
par[i] = i;
if (b[i] == '0') csz[i] = 0;
else csz[i] = 1;
if (hasval[a[i]].empty()) vals.pb(a[i]);
hasval[a[i]].pb(i);
}
int out = 0;
rep(i, 0, n) {
if (b[i] == '1' && i != n-1) Union(i, i+1);
}
vi checkme;
sort(all(vals));
rep(ind, 0, sz(vals)) {
for (int i : hasval[vals[ind]]) {
if (b[i] == '0') {
checkme.pb(getPar(i));
checkme.pb(getPar(i+1));
} else {
checkme.pb(getPar(i));
}
}
//cout << "value " << vals[ind] << endl;
for (int x : checkme) {
//cout << vals[ind] << ' ' << x << endl;
if (csz[getPar(x)] >= k) out = vals[ind];
}
checkme.clear();
for (int i: hasval[vals[ind]]) {
if (b[i] == '0') {
Union(i, i+1);
} else {
csz[getPar(i)]--;
}
}
}
cout << out << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3620kb
input:
5 2 1 2 3 4 5 01101
output:
2
result:
ok answer is '2'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
5 2 3 4 5 2 1 10101
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3848kb
input:
1 1 1 1
output:
1
result:
ok answer is '1'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
1 1 1 0
output:
0
result:
ok answer is '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
5 3 8 3 5 2 7 10101
output:
5
result:
ok answer is '5'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
10 3 1 10 2 3 9 3 1 6 9 3 1100110001
output:
0
result:
ok answer is '0'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
10 1 6 7 2 10 8 4 4 9 7 9 0111011000
output:
10
result:
ok answer is '10'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
10 2 4 5 9 6 9 10 6 9 2 7 1100010100
output:
9
result:
ok answer is '9'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
10 3 2 10 8 5 8 3 7 9 9 1 1100011100
output:
3
result:
ok answer is '3'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
10 5 5 5 9 2 7 2 4 8 4 8 1010001100
output:
0
result:
ok answer is '0'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3536kb
input:
10 10 6 5 8 3 2 8 6 4 5 5 0111001100
output:
0
result:
ok answer is '0'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
100 1 13 90 87 79 34 66 76 58 65 37 63 38 84 88 89 98 63 55 16 39 64 50 28 64 4 69 40 51 75 37 11 9 20 29 36 29 30 61 38 54 92 78 72 36 78 24 78 8 98 11 2 41 64 51 45 67 27 80 67 84 73 50 99 82 39 70 84 18 54 43 85 96 59 98 82 5 57 46 68 31 97 89 21 65 57 37 58 25 30 40 15 76 44 85 75 65 22 97 93 82...
output:
97
result:
ok answer is '97'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3784kb
input:
100 2 91 44 64 58 26 25 62 97 13 27 8 49 93 15 43 16 8 96 98 48 43 7 41 81 61 90 10 69 49 24 48 22 32 59 10 67 45 54 53 47 47 71 48 48 18 42 45 17 42 96 23 37 2 38 66 22 31 83 89 23 51 81 56 71 58 61 22 67 41 58 93 67 90 58 65 50 64 1 12 58 25 20 81 25 99 87 72 63 42 51 80 93 42 1 22 99 38 66 59 87 ...
output:
93
result:
ok answer is '93'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
100 3 64 5 41 41 14 81 44 37 57 18 37 76 14 33 1 42 57 48 83 54 26 68 49 6 22 98 80 95 24 15 80 34 28 88 81 4 55 55 63 28 1 68 31 60 58 56 4 35 98 85 51 33 37 28 91 69 35 98 2 58 29 16 21 52 86 59 56 12 23 77 4 43 20 18 48 3 76 43 69 92 49 55 53 1 46 41 95 100 59 59 33 2 32 10 69 41 54 43 33 88 1000...
output:
98
result:
ok answer is '98'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
100 5 24 13 82 100 90 96 9 20 44 2 8 10 48 70 18 70 54 45 39 80 81 86 77 45 36 35 25 35 68 1 49 44 44 52 19 80 77 48 96 2 14 53 2 83 42 92 25 62 93 64 92 21 10 2 33 71 56 13 28 33 89 71 48 21 30 49 28 14 96 7 32 2 84 22 22 5 100 53 81 53 1 28 89 36 39 32 45 72 80 77 67 20 17 34 68 21 95 89 86 82 111...
output:
92
result:
ok answer is '92'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
100 10 60 15 71 37 79 22 49 20 24 52 59 73 16 74 61 61 76 67 80 24 40 57 58 60 74 15 88 82 48 2 79 5 29 59 50 97 25 89 44 61 72 72 15 58 67 38 85 89 11 53 6 29 16 59 21 3 35 57 11 79 21 45 15 50 54 81 33 74 79 57 38 16 4 16 85 79 86 88 89 94 73 61 41 62 16 34 74 22 69 52 41 61 57 65 47 52 58 27 62 5...
output:
0
result:
ok answer is '0'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
1000 1 16 268 532 802 697 699 25 496 26 392 782 112 381 491 241 251 659 538 980 203 216 653 855 249 908 282 370 222 747 698 628 555 966 546 455 704 992 572 352 753 754 523 956 772 576 26 214 468 434 374 826 121 708 623 102 726 126 203 747 842 780 212 776 831 646 141 823 678 666 352 159 225 813 875 3...
output:
998
result:
ok answer is '998'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
1000 3 840 350 5 127 976 86 453 606 146 406 984 315 800 700 736 350 438 129 317 123 71 404 866 698 535 383 711 697 286 408 173 749 867 410 221 797 623 393 242 231 446 209 802 985 426 40 688 313 815 112 717 933 40 278 219 709 425 118 209 828 202 260 114 194 955 284 349 756 530 403 326 883 574 523 532...
output:
992
result:
ok answer is '992'
Test #19:
score: 0
Accepted
time: 1ms
memory: 3736kb
input:
1000 5 369 431 991 157 551 473 882 124 75 908 786 814 219 396 231 152 922 912 846 555 334 259 70 44 969 972 460 276 18 118 615 136 473 273 180 698 446 23 835 926 434 488 248 494 572 54 755 863 197 850 8 450 780 229 336 499 428 328 670 325 113 12 555 661 967 723 979 131 587 557 902 348 335 876 32 994...
output:
989
result:
ok answer is '989'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
1000 10 558 175 881 102 799 77 406 116 557 496 850 115 753 932 264 815 105 999 87 690 886 91 157 23 126 561 792 423 699 145 12 751 721 316 760 648 532 58 728 998 504 988 588 786 639 555 816 960 895 814 930 553 505 865 672 802 515 640 607 788 935 280 749 930 714 263 447 598 310 863 83 348 456 383 24 ...
output:
0
result:
ok answer is '0'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3688kb
input:
1000 20 620 144 761 386 955 555 846 860 648 33 365 928 372 682 690 56 46 584 301 73 447 4 378 372 438 727 914 989 990 578 312 159 451 686 701 759 337 173 509 453 501 71 104 30 553 214 738 908 180 635 635 788 392 486 231 607 27 258 942 362 670 646 237 566 505 397 996 384 325 375 663 482 912 966 381 3...
output:
0
result:
ok answer is '0'
Test #22:
score: 0
Accepted
time: 22ms
memory: 9060kb
input:
100000 1 75596 43210 60392 73956 89721 58890 69088 99091 79446 29132 81469 36463 54769 54195 24420 89190 6601 14650 71535 50301 9777 52332 86156 21449 15089 50218 38012 97492 40389 73641 47381 18782 83036 21489 12737 77305 60378 82175 73661 96172 77078 85443 53723 84306 44029 38403 63520 52984 24717...
output:
99806
result:
ok answer is '99806'
Test #23:
score: 0
Accepted
time: 22ms
memory: 9104kb
input:
100000 1 58436 79159 12088 11675 27026 85846 18682 22015 7301 98500 7290 9775 79480 522 5590 97796 91883 21748 16528 7806 45283 50837 79182 40833 90791 96386 45242 27539 79365 87154 43362 62560 70987 55781 3961 41974 75150 32186 95892 68329 62054 79223 6895 48464 16752 43460 93638 32582 94475 33168 ...
output:
99992
result:
ok answer is '99992'
Test #24:
score: 0
Accepted
time: 20ms
memory: 9108kb
input:
100000 1 92132 74537 15391 19185 42953 59737 54999 57967 52435 15229 90265 91853 79841 92463 35266 46360 39669 93069 74008 81794 24469 26268 85027 29854 11627 78435 13614 51175 79718 97036 35947 55258 50551 62214 69292 39287 70965 76677 77547 6468 74841 37889 11235 18986 33827 77395 48180 64150 51 9...
output:
100000
result:
ok answer is '100000'
Test #25:
score: 0
Accepted
time: 17ms
memory: 9040kb
input:
100000 1 58532 13018 51397 93992 83071 66333 99829 93919 54465 64662 32023 73932 88714 17108 8046 94925 11647 97094 31488 12677 36359 93187 58168 86171 56655 3588 57795 99003 88583 63813 4339 15251 62819 1352 34623 69303 42588 64273 59201 20415 44524 53451 58678 13700 42389 78625 35426 63014 72923 8...
output:
99999
result:
ok answer is '99999'
Test #26:
score: 0
Accepted
time: 20ms
memory: 9040kb
input:
100000 1 95150 96341 47866 97149 33188 6399 60907 51653 8486 78590 64269 28386 34327 73811 54083 81798 60027 39617 93398 61668 1917 92461 19666 69048 34092 44356 19238 34588 8250 37717 23176 43028 72924 59891 80367 46787 91500 15252 58903 23444 21770 4820 61536 11506 36279 14419 84719 15823 568 7851...
output:
100000
result:
ok answer is '100000'
Test #27:
score: 0
Accepted
time: 22ms
memory: 9224kb
input:
100000 3 33150 44073 28368 74971 98085 12473 55871 99271 75417 93970 34199 21507 6782 82936 61413 40879 2156 29669 87597 43423 38706 40774 92774 25881 14830 45566 1657 49370 59958 2051 79685 12434 43186 95964 36062 66403 39711 89545 75274 88358 99245 79067 2211 8646 25154 97335 25816 23362 55062 872...
output:
0
result:
ok answer is '0'
Test #28:
score: 0
Accepted
time: 17ms
memory: 9236kb
input:
100000 3 89814 11337 34413 98954 17413 35571 56496 87944 47611 86110 4493 12194 55472 5017 76688 45576 89474 19573 1256 20366 65138 3849 15527 32460 37892 17135 63717 45375 35075 48996 30045 91461 41850 97547 62350 97093 62972 779 53883 34021 94332 41965 59916 66610 47766 71935 50379 87964 38917 550...
output:
99649
result:
ok answer is '99649'
Test #29:
score: 0
Accepted
time: 24ms
memory: 9264kb
input:
100000 3 56214 82522 70420 6464 33339 66358 25517 48088 16937 2839 54764 94273 97049 96958 6364 94140 94156 23598 58736 18545 1220 3472 88668 21481 50216 74992 75193 93202 11236 15773 31141 84159 54118 3981 27681 2917 67299 12567 2833 72160 64016 33335 64256 94028 64841 40461 13433 19531 79085 17310...
output:
99986
result:
ok answer is '99986'
Test #30:
score: 0
Accepted
time: 23ms
memory: 9224kb
input:
100000 3 22614 21004 73723 24374 73458 40249 37643 84040 18967 19568 29226 76351 73218 45795 79144 42705 98838 94919 48920 92532 13110 46199 94513 77798 71052 24337 52078 49542 44293 25654 23726 76857 33683 43118 25716 230 30410 162 84488 10298 76803 16193 35892 64549 73403 74395 679 51099 84661 468...
output:
99994
result:
ok answer is '99994'
Test #31:
score: 0
Accepted
time: 22ms
memory: 9092kb
input:
100000 3 76895 64499 15842 65460 41553 59982 23498 51833 4457 19236 60103 48023 53635 2552 15268 9295 98686 63147 9460 22086 55038 80904 93579 40776 33833 7001 48291 62275 3626 98831 88184 12487 370 34366 95180 35885 70833 12222 60516 39821 76641 98443 44616 60038 17404 83750 47015 53498 74017 31603...
output:
99998
result:
ok answer is '99998'
Test #32:
score: 0
Accepted
time: 14ms
memory: 9212kb
input:
100000 5 14896 12231 29048 43282 6450 33352 51167 7964 71387 58808 30033 41144 26090 11676 98407 25272 73520 20495 27852 71137 91826 96513 66688 97610 81866 84019 30710 9761 79526 38972 44694 14597 70631 3143 83580 46989 43236 53811 76887 80543 78309 48498 85291 89882 6280 23562 96623 93741 28510 40...
output:
0
result:
ok answer is '0'
Test #33:
score: 0
Accepted
time: 15ms
memory: 9284kb
input:
100000 5 86599 52026 89443 86232 75096 9487 94310 78064 79409 73720 68993 14613 72681 9512 47786 17548 52473 25910 85983 32925 9185 89565 94976 56791 52289 80987 58000 20106 90785 438 49431 20363 69609 6610 96546 60723 59305 3964 3362 67009 83507 80515 4425 17459 78780 35001 82928 76049 50655 20054 ...
output:
76283
result:
ok answer is '76283'
Test #34:
score: 0
Accepted
time: 26ms
memory: 9092kb
input:
100000 5 52999 90507 92745 36847 15214 16083 6436 14016 81439 90450 19263 96692 81554 25645 20567 9216 91747 29935 360 31104 21075 56484 821 13108 97317 30333 69476 76445 66946 34511 50528 13061 24982 45747 27286 33844 55120 48456 28120 5147 28998 63373 8765 12173 95855 68935 70175 74913 23527 49601...
output:
99947
result:
ok answer is '99947'
Test #35:
score: 0
Accepted
time: 18ms
memory: 9148kb
input:
100000 5 19399 53181 28752 11653 63844 22678 75457 82672 59277 7179 93726 78770 14619 50290 50243 57780 96429 1256 25136 5091 32965 23403 6666 69425 18153 12382 46361 81 43107 77096 18920 5758 4546 52181 16809 31157 26743 36051 9774 75990 41785 54743 80401 82695 4417 37462 525 6481 96399 11852 23842...
output:
99992
result:
ok answer is '99992'
Test #36:
score: 0
Accepted
time: 14ms
memory: 9060kb
input:
100000 5 25937 32658 83818 99179 49917 56669 42986 84718 427 51371 12833 33068 5647 63996 84966 93688 94242 45462 25523 82504 83966 69346 67493 45209 870 45453 36128 22665 90491 35752 53193 47355 60519 8841 18505 92278 74358 19592 53617 32006 98808 92067 27696 84378 98529 42682 17823 23876 47466 846...
output:
99995
result:
ok answer is '99995'
Test #37:
score: 0
Accepted
time: 13ms
memory: 9096kb
input:
100000 10 35705 74924 46599 52611 37175 34341 83754 85699 19404 61432 94780 73382 1676 26879 99237 3462 8078 31509 96909 95360 30221 63771 21825 59928 88680 94196 44306 99667 86690 65192 12821 76026 69987 86117 43332 92573 94165 25177 32571 58446 70215 37241 8220 16834 88558 79678 79916 10548 68959 ...
output:
0
result:
ok answer is '0'
Test #38:
score: 0
Accepted
time: 19ms
memory: 9004kb
input:
100000 10 47457 16845 68058 966 2578 79726 92609 69618 63492 98464 62120 71038 19976 79230 95738 3759 95397 83925 24695 5660 99956 82825 46098 39378 94595 59152 44723 10195 17971 81045 93557 38898 61690 75031 13673 23736 48610 54919 38962 675 72328 77230 17799 2626 25342 83620 69749 78074 3977 21786...
output:
0
result:
ok answer is '0'
Test #39:
score: 0
Accepted
time: 19ms
memory: 9072kb
input:
100000 10 13857 55327 71361 8476 51208 86322 61631 38274 32817 15193 12391 53117 96145 71171 25414 95427 67375 20654 39071 79647 11846 49744 51943 95695 15431 84305 88903 90726 94133 90926 61950 98892 73959 81464 3196 21049 44425 66707 87912 14621 17819 68600 22139 38556 66609 17555 56995 9642 76849...
output:
98935
result:
ok answer is '98935'
Test #40:
score: 0
Accepted
time: 22ms
memory: 9076kb
input:
100000 10 12962 26512 7368 91795 91326 92917 30652 98418 2143 64627 86853 2492 37722 95816 55090 43991 15161 91975 63847 10530 47929 25175 33596 84716 68971 66354 33084 14362 94486 57703 63047 91589 53523 20601 1232 51066 83344 54303 69567 52760 63310 51458 93775 33269 83683 86081 20049 8506 6617 13...
output:
99977
result:
ok answer is '99977'
Test #41:
score: 0
Accepted
time: 16ms
memory: 9072kb
input:
100000 10 46747 52247 34073 75804 80642 24953 84084 29750 72636 53995 77580 99898 81233 46495 85796 4581 61504 89180 94580 74024 22361 36604 55334 74823 7683 55630 82428 12571 21847 29268 88616 76080 59874 24518 35153 37863 25287 82446 17813 9909 23419 56618 83330 35523 48104 55694 33819 40684 87914...
output:
99986
result:
ok answer is '99986'
Test #42:
score: 0
Accepted
time: 14ms
memory: 9064kb
input:
100000 30 67883 29953 33878 42998 86900 15259 82386 17497 7014 25932 97200 57887 6171 30681 47017 33757 5903 73133 9468 39407 83232 75924 89260 74325 9429 12671 19037 55377 5428 84579 74426 46890 11753 77209 6962 56203 97350 74656 98263 56132 32957 90263 59069 47848 17032 69123 68001 22286 33954 189...
output:
0
result:
ok answer is '0'
Test #43:
score: 0
Accepted
time: 18ms
memory: 9112kb
input:
100000 30 96499 60812 36034 1981 10942 9118 12097 2503 59462 63302 57954 90675 47797 7970 56924 63960 34057 7456 64949 66078 20373 71267 95819 43811 70144 64900 41071 62073 37540 85263 34374 41061 89136 49506 28487 47426 27943 86481 64767 92860 27199 38149 33583 26966 6467 42552 64749 81156 77426 74...
output:
0
result:
ok answer is '0'
Test #44:
score: 0
Accepted
time: 19ms
memory: 9232kb
input:
100000 30 95603 56189 39337 85299 26869 39905 24222 38455 28788 80032 65121 72754 48158 99911 62408 79820 38738 78777 55133 40065 64967 5482 1665 32832 15172 14245 85252 18413 13701 52040 26958 25247 1405 88643 26522 10147 23758 6781 89525 30999 39986 29519 37923 87088 47734 86886 95099 80020 74490 ...
output:
0
result:
ok answer is '0'
Test #45:
score: 0
Accepted
time: 16ms
memory: 9024kb
input:
100000 30 62003 94671 75344 60106 99691 46500 93243 74407 30818 96761 82687 54833 89735 48748 92084 28384 43420 82801 12614 38244 76857 80913 74806 89149 3304 96294 29433 66240 14055 94625 28055 17945 80969 95076 91853 7459 62677 18568 38476 77650 18181 12377 9559 57609 64809 88117 82345 78884 80066...
output:
99966
result:
ok answer is '99966'
Test #46:
score: 0
Accepted
time: 21ms
memory: 9228kb
input:
100000 30 54732 74572 21351 66190 87263 95471 74205 70060 60246 51198 80000 84403 53025 50297 872 26364 35137 73908 31331 18071 99565 7541 22769 21924 95728 49913 263 68281 49096 48655 17517 46943 1641 91419 66080 58389 28472 40437 83505 74892 53457 33832 1475 66537 43874 55539 21905 19718 9805 9597...
output:
99952
result:
ok answer is '99952'
Test #47:
score: 0
Accepted
time: 17ms
memory: 9088kb
input:
100000 100 16495 30894 35890 60867 39567 8268 64061 674 43561 16262 23340 89687 47680 49731 81008 6976 35663 63868 70570 74226 62208 73791 53074 63732 18742 26381 51153 38273 13285 91196 89159 66730 21940 95829 57798 41842 51490 59735 40724 9936 68222 48146 95085 49616 28718 88493 25407 87346 24873 ...
output:
0
result:
ok answer is '0'
Test #48:
score: 0
Accepted
time: 22ms
memory: 9116kb
input:
100000 100 31758 48559 21561 12325 25840 98281 39979 56227 94937 30765 75432 18358 42691 51913 94748 26542 96874 33488 82773 18015 20400 94263 57575 10562 68186 37721 51016 12369 64272 72596 34805 28846 48641 39658 1164 14812 82397 22113 65168 62949 98169 29028 72297 35154 69871 24895 18849 2934 482...
output:
0
result:
ok answer is '0'
Test #49:
score: 0
Accepted
time: 19ms
memory: 9228kb
input:
100000 100 98159 87041 57568 87131 65959 37580 76296 16371 96967 47494 92998 437 18860 76558 232 75107 11956 37513 7549 92002 56482 61182 63420 66878 89022 19771 95197 92901 40434 6670 35902 56136 60910 46092 66495 12125 21316 42413 14118 33791 43660 87694 43933 62572 78434 26126 6095 34502 21091 39...
output:
0
result:
ok answer is '0'
Test #50:
score: 0
Accepted
time: 22ms
memory: 9264kb
input:
100000 100 64559 58226 60871 70450 14589 35664 21125 85027 74805 64223 165 82516 84629 68499 29908 90967 16638 8834 21925 90181 68372 28101 69265 23195 9858 69116 39378 16536 73491 49255 61190 48833 40474 85229 31826 9438 92939 30009 95773 47738 56447 70552 48272 33094 28212 27356 69149 66070 50859 ...
output:
96480
result:
ok answer is '96480'
Test #51:
score: 0
Accepted
time: 17ms
memory: 9276kb
input:
100000 100 60241 8217 23364 84059 7227 31584 55880 53236 72601 8825 6140 48906 27237 69347 34863 8095 23680 97347 92433 52890 54349 70816 53879 87139 37745 20519 97787 51178 48442 87976 97658 66784 11828 66935 60020 11324 82613 92812 50158 28695 12914 227 46003 76816 88264 7613 12015 50186 76532 480...
output:
99917
result:
ok answer is '99917'
Test #52:
score: 0
Accepted
time: 19ms
memory: 9036kb
input:
100000 300 84654 31574 36905 36527 93150 3563 64241 96645 84207 12096 75681 8995 9124 86725 32697 11044 17977 12634 87884 70451 50651 80409 24802 6576 14090 90025 11543 57842 41694 56204 58618 94176 96416 43346 14191 45367 91564 61348 89806 56295 61845 63930 19425 30742 30753 50789 28490 93499 10665...
output:
0
result:
ok answer is '0'
Test #53:
score: 0
Accepted
time: 18ms
memory: 9148kb
input:
100000 300 39744 3589 76136 70008 32461 68799 5908 88025 82548 95264 77851 35567 47186 23012 42527 56837 70507 18216 62628 37870 97604 30608 81905 92254 64743 32004 34259 68079 83010 91983 63707 99709 14600 6559 32091 2634 85582 47400 30860 60635 36719 49345 14634 66168 65641 57445 6934 47376 45918 ...
output:
0
result:
ok answer is '0'
Test #54:
score: 0
Accepted
time: 22ms
memory: 9280kb
input:
100000 300 6144 42070 44847 77518 48387 42690 74929 56681 51874 11993 95418 17645 23355 47656 72204 72698 75189 89537 77004 36049 9494 40631 55047 81275 9771 14054 69928 24419 91875 1864 64803 59703 2676 45696 97422 75755 57205 67700 79810 98773 6402 64907 18974 93586 82716 58675 61476 46240 42982 1...
output:
0
result:
ok answer is '0'
Test #55:
score: 0
Accepted
time: 18ms
memory: 9052kb
input:
100000 300 72544 80552 48149 85029 88505 81990 11246 92633 86607 61426 2584 23916 56420 39597 77688 21262 47167 26266 34485 42740 21384 40254 60892 70296 97903 63399 14109 72247 68037 68641 57388 52401 82241 52130 95457 5771 28828 79487 28760 12720 19189 23573 99122 64108 91279 59905 24530 77808 158...
output:
0
result:
ok answer is '0'
Test #56:
score: 0
Accepted
time: 18ms
memory: 9272kb
input:
100000 300 61103 76193 24379 59720 60810 18368 64572 49207 37439 4659 58481 919 23274 30533 86552 70947 47211 37601 85555 49114 34279 53242 58312 54176 67686 84164 25473 70746 85363 52984 67117 59638 53599 57556 49117 90657 55391 27129 42344 83566 82345 83307 94535 57942 90299 69909 82393 47826 6232...
output:
99154
result:
ok answer is '99154'
Test #57:
score: 0
Accepted
time: 19ms
memory: 9220kb
input:
100000 1 42308 87211 66126 49493 45069 7069 46699 38027 73145 27022 46851 50031 46686 30984 2563 49879 87265 41486 85806 43566 48830 35764 95864 99154 76934 86177 51020 69974 89244 87284 91432 52290 52888 79644 69148 71566 40420 34815 41359 2411 45953 61108 41114 81306 58563 82377 71018 41042 36561 ...
output:
0
result:
ok answer is '0'
Test #58:
score: 0
Accepted
time: 17ms
memory: 10392kb
input:
100000 100000 65653 44441 79391 24795 98622 25795 33874 50892 19355 59532 99624 33328 77870 90923 80410 58923 16617 23854 81174 48820 57875 63637 65277 66004 13866 67060 94693 89131 18172 92437 58647 57771 32972 53108 26162 19515 88435 89409 81446 55765 3997 28962 17338 95272 30312 57134 8839 87478 ...
output:
2
result:
ok answer is '2'
Test #59:
score: 0
Accepted
time: 6ms
memory: 5732kb
input:
100000 316 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1...
output:
1
result:
ok answer is '1'
Test #60:
score: 0
Accepted
time: 17ms
memory: 9148kb
input:
100000 316 25420 12431 83505 29629 32749 93741 28834 8943 17005 69713 8247 1261 21259 31906 84584 41862 84023 36058 23487 66207 62104 47016 45310 31569 20071 5039 44919 9960 74674 38821 80210 31301 8634 4309 68778 71197 86293 47901 10000 2201 61868 93489 40263 12884 2590 35286 68422 39200 30748 6794...
output:
99660
result:
ok answer is '99660'
Test #61:
score: 0
Accepted
time: 16ms
memory: 9204kb
input:
100000 316 12984 56143 83690 30803 37474 17195 8900 59536 90808 14395 79545 16735 52523 22297 30771 82598 8547 58772 52211 57212 48439 88303 13133 37743 3894 66048 88871 76287 61025 76146 54623 41664 29006 90499 50978 71452 4775 32903 65718 79503 94889 83299 2705 3209 94086 22707 21407 39824 85379 9...
output:
99665
result:
ok answer is '99665'
Test #62:
score: 0
Accepted
time: 17ms
memory: 9224kb
input:
100000 3 43516 66785 17401 91420 15695 37176 80701 4888 91684 41502 65210 44744 12510 15453 38444 28259 76946 37619 53827 81743 53770 78451 60705 87083 24259 76516 65151 88294 71630 16544 32743 84933 15122 54807 1403 79265 85896 17290 20429 24070 43710 45136 97477 72566 43157 5556 22399 23620 96675 ...
output:
0
result:
ok answer is '0'
Test #63:
score: 0
Accepted
time: 21ms
memory: 9128kb
input:
100000 3160 43156 58749 45633 64749 23992 86940 31474 61705 76844 69683 29458 52835 98720 90601 25669 61924 60905 86118 68369 79031 48448 2234 28801 72622 17379 47190 92837 27931 48307 16017 27376 22264 65525 44068 98361 96000 19633 10863 3546 45235 8822 72434 91764 83318 65748 82228 46793 13169 531...
output:
87673
result:
ok answer is '87673'
Test #64:
score: 0
Accepted
time: 21ms
memory: 9420kb
input:
100000 30601 61186 45069 6119 93013 5697 31540 92835 3101 5592 43919 3668 47714 13676 61219 53544 97954 41846 41226 90913 43410 86851 43186 63191 66361 69010 81981 75348 64946 59737 28895 25910 36686 79969 22435 50736 76592 4421 5926 2473 68847 89431 98874 30523 59511 80252 52581 48245 21864 45419 6...
output:
5932
result:
ok answer is '5932'
Test #65:
score: 0
Accepted
time: 16ms
memory: 10512kb
input:
100000 50000 1 100000 2 99999 3 99998 4 99997 5 99996 6 99995 7 99994 8 99993 9 99992 10 99991 11 99990 12 99989 13 99988 14 99987 15 99986 16 99985 17 99984 18 99983 19 99982 20 99981 21 99980 22 99979 23 99978 24 99977 25 99976 26 99975 27 99974 28 99973 29 99972 30 99971 31 99970 32 99969 33 9996...
output:
0
result:
ok answer is '0'
Test #66:
score: 0
Accepted
time: 10ms
memory: 10364kb
input:
100000 50000 100000 1 99999 2 99998 3 99997 4 99996 5 99995 6 99994 7 99993 8 99992 9 99991 10 99990 11 99989 12 99988 13 99987 14 99986 15 99985 16 99984 17 99983 18 99982 19 99981 20 99980 21 99979 22 99978 23 99977 24 99976 25 99975 26 99974 27 99973 28 99972 29 99971 30 99970 31 99969 32 99968 3...
output:
50001
result:
ok answer is '50001'
Test #67:
score: 0
Accepted
time: 19ms
memory: 11592kb
input:
100000 2 1 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 1...
output:
0
result:
ok answer is '0'
Test #68:
score: 0
Accepted
time: 3ms
memory: 11044kb
input:
100000 50001 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...
output:
0
result:
ok answer is '0'
Test #69:
score: 0
Accepted
time: 9ms
memory: 11252kb
input:
99999 50000 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 ...
output:
0
result:
ok answer is '0'
Test #70:
score: 0
Accepted
time: 10ms
memory: 10496kb
input:
99856 316 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...
output:
1
result:
ok answer is '1'
Test #71:
score: 0
Accepted
time: 13ms
memory: 11252kb
input:
100000 2 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...
output:
1
result:
ok answer is '1'
Test #72:
score: 0
Accepted
time: 4ms
memory: 10756kb
input:
100000 2 49999 49999 49999 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 ...
output:
49999
result:
ok answer is '49999'
Test #73:
score: 0
Accepted
time: 6ms
memory: 6448kb
input:
99999 50000 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 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 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
0
result:
ok answer is '0'
Test #74:
score: 0
Accepted
time: 18ms
memory: 9096kb
input:
100000 5 92249 5196 513 72379 65535 24849 86227 62833 98727 63996 53351 62755 33200 53692 87687 71736 71500 8405 34734 30480 69057 51711 9102 99356 23307 76036 9868 41154 91896 70150 25535 58266 89930 36662 16564 41843 569 82526 50349 21615 15279 67769 30749 88514 73930 41589 33998 79991 96861 89336...
output:
37225
result:
ok answer is '37225'
Test #75:
score: 0
Accepted
time: 15ms
memory: 9112kb
input:
100000 8 72803 34674 49767 51156 61711 41541 20382 67016 91871 56444 53441 89188 3523 1609 59601 51999 69518 5350 98483 54066 43863 26094 22959 42269 84824 33601 24180 41024 78418 80420 35122 1698 92039 98559 51294 39214 87807 39933 66450 7025 89572 2223 88938 82302 20741 65833 24616 75754 85783 838...
output:
85400
result:
ok answer is '85400'
Test #76:
score: 0
Accepted
time: 18ms
memory: 9052kb
input:
100000 8 90627 64557 93585 1904 31674 42155 26483 43926 18822 38883 92455 65099 64037 67113 15649 70156 75556 37351 74829 61836 13288 45753 102 98802 74249 34864 73855 5464 81234 49775 89918 12525 71587 55537 11452 93876 70671 36577 38566 17795 19838 26592 86815 62053 36108 47714 31132 19641 79464 9...
output:
87290
result:
ok answer is '87290'
Test #77:
score: 0
Accepted
time: 20ms
memory: 9216kb
input:
100000 13 56767 89245 17450 13490 33725 33756 9162 96383 72291 7713 83407 55425 46241 80999 21958 22141 35070 34174 12397 76172 43538 15975 57817 18459 65549 48889 42897 9610 91215 5120 12528 81101 67246 60888 77703 15438 28947 52822 20120 9800 9917 76544 20316 33678 25468 95247 99134 51938 25719 93...
output:
89573
result:
ok answer is '89573'
Test #78:
score: 0
Accepted
time: 20ms
memory: 9004kb
input:
100000 20 95552 12707 40631 11678 34556 17697 31361 79562 73190 46075 62224 54696 62876 69552 92369 18865 61684 82392 79328 73207 42198 8027 97234 81405 67488 32376 42925 51035 60289 30143 5099 97403 55262 33975 88187 29439 25327 53369 95840 4473 19619 38290 39312 65552 28472 73157 39574 42242 57828...
output:
88372
result:
ok answer is '88372'
Test #79:
score: 0
Accepted
time: 19ms
memory: 9092kb
input:
100000 24 76105 42184 89885 57751 73836 68981 98220 83745 33629 5818 95018 81129 495 17469 64283 23320 59702 79337 43077 20985 49708 82411 11091 24318 61709 48725 33045 50905 71003 40414 47390 40836 14266 28575 22917 83706 12565 53880 3429 98395 93911 72745 30205 83532 7987 97401 97488 62196 70941 6...
output:
4404
result:
ok answer is '4404'
Test #80:
score: 0
Accepted
time: 15ms
memory: 9104kb
input:
100000 42 80851 71662 14947 60720 2715 85673 65080 20631 26773 65562 95109 50666 70818 98091 12005 70878 57720 43578 63721 68763 321 24090 57652 10334 55930 73586 47358 50775 90229 59196 32785 16972 49079 98983 57647 13781 32506 43990 52233 83806 59692 64095 64201 44616 22095 56237 63914 23367 84055...
output:
59969
result:
ok answer is '59969'
Test #81:
score: 0
Accepted
time: 15ms
memory: 9048kb
input:
100000 55 94109 25331 31496 39497 74698 36957 99235 92109 63021 92602 95199 77099 65333 46008 16624 75332 88442 83626 27470 92349 40534 22665 4213 20542 17447 31151 37478 17942 9455 36762 75077 60404 18484 93583 25080 11152 19744 1397 92526 10432 25473 98550 22390 38403 77418 80481 21828 43322 72977...
output:
24985
result:
ok answer is '24985'
Test #82:
score: 0
Accepted
time: 17ms
memory: 9144kb
input:
100000 104 7366 54809 56558 85570 38170 53649 33391 96292 23460 52345 95289 79341 35656 93925 64346 22890 86461 13275 91219 40126 48044 64344 18070 30750 11668 80204 19087 17812 52873 47033 17368 71133 53297 63992 27106 41226 74278 67316 8627 95843 23958 33004 56387 99487 91526 4725 12446 71789 8609...
output:
50024
result:
ok answer is '50024'
Test #83:
score: 0
Accepted
time: 13ms
memory: 9120kb
input:
100000 214 25191 60500 89976 36317 40837 62775 6787 5906 83116 34784 34303 12148 28874 83621 20395 73752 59795 45277 34860 23704 17470 49412 95213 19988 35685 89978 68762 82252 31497 49092 39460 14664 32845 88266 44160 63185 57142 88151 80744 73909 97329 57373 78456 3430 31085 86606 18962 15676 7977...
output:
72368
result:
ok answer is '72368'
Test #84:
score: 0
Accepted
time: 21ms
memory: 9108kb
input:
100000 760 50830 2973 54329 64481 81000 40130 81345 78168 6757 86221 66160 84256 62878 45324 92529 66953 68785 54769 97716 8487 45823 86164 20332 16594 65901 73069 27823 76454 40291 61850 64730 26084 46128 2847 69259 37615 64867 46145 75301 58064 69107 32138 77135 33395 32377 8329 12149 77704 38609 ...
output:
3632
result:
ok answer is '3632'
Test #85:
score: 0
Accepted
time: 21ms
memory: 9072kb
input:
100000 5162 829 55540 66124 2483 64455 17451 69941 92191 44397 4097 57357 26284 14409 42295 37575 24039 91689 33156 66827 20207 35951 5363 40053 63611 16015 55651 89556 43089 16820 74758 27692 3312 67835 25218 99700 39783 94326 31283 17497 56635 4554 82407 42233 84517 28625 72736 34121 14066 15769 9...
output:
69855
result:
ok answer is '69855'
Test #86:
score: 0
Accepted
time: 21ms
memory: 9508kb
input:
100000 35298 54878 99004 81584 43358 19174 60281 80613 40145 58977 63201 15424 21347 86621 78029 32078 52221 35752 82777 16833 59409 4311 3143 29168 98576 93346 18395 15125 76018 75462 29472 9805 50674 57378 18049 62748 81936 90714 97681 96326 23309 66775 27556 41367 13778 62533 13587 70428 13769 97...
output:
1
result:
ok answer is '1'
Test #87:
score: 0
Accepted
time: 22ms
memory: 9932kb
input:
100000 56010 71103 24811 34151 55153 57176 43737 33743 96037 73001 842 33300 45247 28649 64152 61753 64563 92838 38385 86708 95816 16032 93270 48368 85593 48875 92701 89195 5047 42097 6000 22713 46340 34606 15564 60927 79673 92882 94435 89976 65505 98050 19898 91636 78876 89464 77132 34836 35741 253...
output:
6
result:
ok answer is '6'
Test #88:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
15 5 50 12 65 54 53 46 59 73 71 61 51 6 11 80 61 001011111010111
output:
46
result:
ok answer is '46'
Test #89:
score: 0
Accepted
time: 1ms
memory: 3796kb
input:
17 5 70 70 7 67 24 64 49 1 17 21 2 23 8 38 49 24 60 01111101110100101
output:
7
result:
ok answer is '7'
Test #90:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
15 3 63 5 54 11 81 97 63 46 76 32 81 10 58 81 95 001011000000001
output:
54
result:
ok answer is '54'
Test #91:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
31 5 2 6 2 3 7 8 3 3 3 8 3 6 6 1 3 2 2 5 8 3 7 8 3 5 1 8 8 3 5 4 2 0010010100010101001011110100111
output:
5
result:
ok answer is '5'
Test #92:
score: 0
Accepted
time: 4ms
memory: 6388kb
input:
99997 2 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 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 5...
output:
0
result:
ok answer is '0'
Extra Test:
score: 0
Extra Test Passed