QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#704886 | #1776. Eavesdropper Evasion | TheZone | AC ✓ | 435ms | 4428kb | C++20 | 1.2kb | 2024-11-02 21:24:58 | 2024-11-02 21:24:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,x;
const int M=2e4+4;
int a[M],W;
int F[2][M<<2];
inline auto& f(int now,int w){return F[now][w-W+20000];}
int GET(int num,int sum){
int nsum=0,r;
W=sum/2;
for(int i=0;i<=num;i++){
nsum+=a[i];
if(nsum+a[i+1]>W){r=i+1;break;}
}
if(nsum==W)return sum-W;
int now=1,ed=0;
f(ed,nsum)=r;
// cerr<<"R: "<<f(ed,nsum)<<"\n";
for(int i=r;i<=num;i++){
memset(F[now],0,sizeof F[now]);
for(int j=W+x;j>=W-x;j--){
f(now,j)=max({f(now,j),f(ed,j),f(ed,j-a[i])});
for(int k=f(ed,j);k<f(now,j);k++)f(now,j-a[k])=max(f(now,j-a[k]),k);
// cerr<<i<<" "<<j<<" "<<f(now,j)<<"\n";
}
swap(now,ed);
}
for(int i=W;i>=W-x;i--)if(f(ed,i)!=0)return sum-i;
assert(0);
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin>>n>>x;
for(int i=1;i<=n;i++)cin>>a[i];
sort(a+1,a+n+1);
a[n+1]=1e9;
int pcnt=0;
for(;pcnt<=n+1;pcnt++)if(a[pcnt]>x){pcnt--;break;}
if(pcnt<=2)return cout<<a[n],0;
else if(pcnt<=3)return cout<<max(x+1,a[n]),0;
int sum=0,ans;
for(int i=1;i<=pcnt;i++)a[i]=x-a[i]+1;
reverse(a+1,a+pcnt+1);
pcnt-=4;
for(int i=1;i<=pcnt;i++)sum+=a[i];
ans=GET(pcnt,sum)+x+1;
cout<<max(ans,a[n]);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
input:
20000 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
99990001
result:
ok single line: '99990001'
Test #2:
score: 0
Accepted
time: 218ms
memory: 4428kb
input:
19999 10000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:
99990001
result:
ok single line: '99990001'
Test #3:
score: 0
Accepted
time: 5ms
memory: 4216kb
input:
100 10000 1625 1032 8761 7168 3944 8010 6005 7505 7987 6812 3294 8779 3575 2887 1784 4686 5146 4207 8981 4785 3738 7960 1962 7508 9768 5390 196 7370 1229 413 6069 2233 8250 5692 7839 6538 3691 3961 4913 6795 104 9681 1624 7671 8508 4887 781 3305 5630 2307 2184 3430 1677 853 5998 2762 4580 3543 265 3...
output:
239479
result:
ok single line: '239479'
Test #4:
score: 0
Accepted
time: 1ms
memory: 4336kb
input:
8 10000 3245 1496 6182 6664 9245 6569 3262 832
output:
16770
result:
ok single line: '16770'
Test #5:
score: 0
Accepted
time: 4ms
memory: 4228kb
input:
67 10000 3620 4546 9558 7134 3966 662 9261 2124 2663 4603 8594 7212 1176 1461 6411 9982 9793 8119 8996 697 1377 1084 8072 424 2950 1808 1506 3899 813 5351 7738 4614 6447 444 2458 4502 5505 9068 579 8385 1407 9792 9641 1535 9434 7046 4289 4961 7486 3707 2293 6572 4279 5130 5080 7300 5618 3708 5145 14...
output:
165801
result:
ok single line: '165801'
Test #6:
score: 0
Accepted
time: 4ms
memory: 4312kb
input:
64 10000 3629 7320 6622 5488 8225 1440 5549 8289 541 8818 5238 9173 2296 514 6335 6625 4176 3231 4201 3253 2179 9542 4107 6240 5588 5977 8371 6339 974 2949 8323 7397 5303 6488 2088 8392 799 2572 8260 7854 9780 7302 5823 7142 3065 9494 8759 532 8060 1746 8288 2750 1140 1635 4380 631 6643 5424 6378 64...
output:
141789
result:
ok single line: '141789'
Test #7:
score: 0
Accepted
time: 3ms
memory: 4280kb
input:
54 10000 8843 8338 3435 996 2473 6056 3866 2347 2094 8401 4964 6996 828 4834 4054 6385 7276 3069 6935 6458 3853 2821 2582 2519 8729 509 2426 6382 8027 3627 7973 7070 7175 4077 3585 5879 9106 3575 1806 6173 8142 7174 187 5355 4581 454 5250 8051 627 6888 5683 9565 513 2566
output:
130069
result:
ok single line: '130069'
Test #8:
score: 0
Accepted
time: 3ms
memory: 4228kb
input:
62 10000 6540 9391 4923 2931 9383 6023 605 9507 4866 5574 4342 4835 7758 9737 5837 8875 5008 4495 7758 5442 4638 302 6525 5902 3104 7618 2488 141 694 7185 7613 3114 2645 4808 7537 8710 7124 1187 5861 8489 9819 9484 6375 6013 9519 4160 5177 651 9816 7303 3555 7061 5373 7335 5090 8448 9033 8550 9816 3...
output:
119739
result:
ok single line: '119739'
Test #9:
score: 0
Accepted
time: 3ms
memory: 4352kb
input:
45 10000 7271 9464 12 8487 5063 9602 487 4471 4894 150 4729 1501 6321 7375 5814 1745 6729 9273 7548 4186 8541 1609 9700 6238 2119 1325 118 1021 5481 2345 562 733 7278 5183 4076 6677 23 9943 9230 8054 5886 3474 8775 8140 4260
output:
102217
result:
ok single line: '102217'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
5 10000 9730 5101 2906 932 9143
output:
10272
result:
ok single line: '10272'
Test #11:
score: 0
Accepted
time: 4ms
memory: 4204kb
input:
67 10000 7293 1679 2322 9688 9697 187 5371 7950 666 1696 6150 1572 3669 3769 1696 7368 2085 7496 5295 5985 6809 784 3956 4901 8188 7397 7953 3631 691 1853 7870 1397 8413 7077 5686 8506 1660 5148 1287 9074 249 3368 5416 7127 9192 4321 5616 3962 4059 2419 6550 7317 2740 1592 3867 4148 2563 5903 8545 1...
output:
165345
result:
ok single line: '165345'
Test #12:
score: 0
Accepted
time: 2ms
memory: 4224kb
input:
24 10000 1272 7840 2744 3902 1443 3216 8065 1601 7599 2202 5796 2262 7490 3548 2814 4915 3530 5563 7274 5171 2279 8942 5134 1084
output:
59868
result:
ok single line: '59868'
Test #13:
score: 0
Accepted
time: 162ms
memory: 4416kb
input:
12386 7533 4444 6727 5805 5911 9400 6427 4566 4996 4564 4305 8954 5407 4592 5617 7420 5265 8041 9153 9851 8217 7471 5564 7506 4247 6829 6223 9610 6554 5892 5950 5215 5374 7062 8761 4763 9324 5832 7422 4331 9930 4403 8660 4224 6932 4626 5877 6394 6707 5096 6553 8322 4216 4585 7959 6650 9485 3888 4388...
output:
8875580
result:
ok single line: '8875580'
Test #14:
score: 0
Accepted
time: 185ms
memory: 4308kb
input:
19521 3195 2689 2726 2438 2708 2428 2659 2408 2666 2586 3016 2863 2643 2651 2427 3054 2547 3114 3012 2644 2973 2217 2432 2564 2590 2220 3050 2246 2495 2365 2956 3128 2697 3075 2529 2396 2910 3187 2243 2758 3107 3047 2933 2830 3022 2913 3022 3166 2668 2353 2364 2556 2272 2916 2685 2496 2546 3170 2688...
output:
4783721
result:
ok single line: '4783721'
Test #15:
score: 0
Accepted
time: 164ms
memory: 4364kb
input:
12427 5874 2887 4908 1747 5841 5649 2911 4482 5571 1826 5011 3211 5699 4768 1954 2146 4485 5570 4924 2486 2761 1981 3808 5002 3581 5244 5787 5582 4593 3072 5840 5764 4421 4656 5275 2802 5678 4542 4795 2802 5061 2677 4791 5322 1476 4580 2341 2626 3633 5040 3385 3826 3043 2929 5180 3089 3251 2786 4585...
output:
13891939
result:
ok single line: '13891939'
Test #16:
score: 0
Accepted
time: 188ms
memory: 4304kb
input:
17475 3525 3442 3495 3171 2946 2960 2850 2934 3446 3012 3419 3249 3498 3457 3202 3048 3458 3081 3045 3365 3295 3361 3318 2959 3083 3317 2924 3498 2917 3508 3401 2922 3123 3313 3228 3279 2891 2870 3127 3381 3068 3059 2982 3486 2853 3163 2973 3160 3488 3374 3291 3010 3197 3436 3454 3502 3523 2961 3471...
output:
3071790
result:
ok single line: '3071790'
Test #17:
score: 0
Accepted
time: 434ms
memory: 4312kb
input:
20000 10000 6891 8377 4970 5867 3579 4618 1554 4105 8726 9862 5082 1209 5410 1650 5181 3351 7816 8542 8990 1529 6535 19 5459 5329 1032 9299 2335 7340 5244 8017 9032 2045 8853 9883 4713 9770 5195 4757 3060 4261 1472 2134 634 8858 8595 3859 9664 6872 7383 5856 1890 5494 3982 4441 3613 2794 1019 2398 3...
output:
50176073
result:
ok single line: '50176073'
Test #18:
score: 0
Accepted
time: 435ms
memory: 4372kb
input:
20000 10000 1034 8118 7738 3440 465 6387 35 4364 3749 1675 502 8871 6246 6916 8645 7175 9059 3783 7531 353 9117 1639 4857 5451 8206 6916 3111 9627 8182 8279 566 6624 2835 6140 8331 2683 6444 485 5055 9719 2792 3719 3269 8984 8418 9467 4412 9977 94 8397 8499 3367 920 5976 3275 6774 5846 26 5426 459 2...
output:
50022115
result:
ok single line: '50022115'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 9 5
output:
5
result:
ok single line: '5'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
1 9 12
output:
12
result:
ok single line: '12'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
2 9 4 15
output:
15
result:
ok single line: '15'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
4 8 2 3 1 19
output:
19
result:
ok single line: '19'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
5 7 2 3 4 5 9
output:
9
result:
ok single line: '9'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
4 7 2 3 4 5
output:
8
result:
ok single line: '8'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
3 7 2 3 4
output:
8
result:
ok single line: '8'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
2 7 2 7
output:
7
result:
ok single line: '7'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
19999 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 8 2 3 4 5 6 7 ...
output:
8
result:
ok single line: '8'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
1 10000 4857
output:
4857
result:
ok single line: '4857'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
2 10000 5002 4918
output:
5002
result:
ok single line: '5002'
Test #30:
score: 0
Accepted
time: 1ms
memory: 4312kb
input:
14 90 30 10 1 42 38 41 45 47 5 11 72 34 68 37
output:
319
result:
ok single line: '319'
Test #31:
score: 0
Accepted
time: 1ms
memory: 4232kb
input:
13 554 412 24 206 400 121 147 112 69 313 230 131 418 100
output:
1865
result:
ok single line: '1865'
Test #32:
score: 0
Accepted
time: 1ms
memory: 4236kb
input:
17 386 33 210 153 246 134 80 113 260 381 273 362 276 202 23 88 135 120
output:
1470
result:
ok single line: '1470'
Test #33:
score: 0
Accepted
time: 1ms
memory: 4356kb
input:
20 102 3 3 28 15 66 66 15 55 16 69 15 15 46 87 29 12 1 1 1 1
output:
657
result:
ok single line: '657'
Test #34:
score: 0
Accepted
time: 4ms
memory: 4316kb
input:
109 8002 3 3 1003 1003 1003 8002 8001 8000 7999 7998 7997 7996 7995 7994 7993 7992 7991 7990 7989 7988 7987 7986 7985 7984 7983 7982 7981 7980 7979 7978 7977 7976 7975 7974 7973 7972 7971 7970 7969 7968 7967 7966 7965 7964 7963 7962 7961 7960 7959 7958 7957 7956 7955 7954 7953 7952 7951 7950 7949 79...
output:
29028
result:
ok single line: '29028'
Test #35:
score: 0
Accepted
time: 6ms
memory: 4236kb
input:
1009 8002 3 3 1003 1003 1003 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8002 8...
output:
29003
result:
ok single line: '29003'
Test #36:
score: 0
Accepted
time: 1ms
memory: 4232kb
input:
18 10000 6263 527 3340 3511 6834 9585 3364 10000 5430 3211 5533 217 7089 4851 847 2627 4619 3005
output:
41698
result:
ok single line: '41698'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
20000 10000 4 2 4 4 4 2 2 4 2 4 2 2 2 2 4 4 2 4 4 4 2 4 4 2 2 4 4 2 4 4 2 2 2 2 4 4 4 4 4 2 2 4 4 4 2 2 4 2 4 4 4 4 4 2 2 2 4 4 4 2 4 4 4 4 4 2 4 4 2 2 2 4 2 4 4 4 4 4 4 4 4 4 2 4 4 2 4 2 4 2 2 2 2 4 2 2 2 4 2 4 4 2 4 2 2 2 4 4 4 4 4 4 4 2 2 4 2 2 2 2 2 4 4 2 4 4 2 2 4 2 4 4 2 4 2 2 4 4 2 4 4 2 4 4 ...
output:
99970004
result:
ok single line: '99970004'
Test #38:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
19999 10000 3 4 3 3 4 4 3 4 3 4 4 3 3 3 3 3 3 3 3 3 3 4 3 3 4 3 3 3 4 4 3 4 3 4 3 3 4 4 3 4 3 3 4 3 3 3 3 4 4 4 4 4 4 3 4 4 4 4 4 4 3 3 3 3 3 3 4 3 4 3 4 3 3 3 4 3 4 4 3 4 4 3 4 3 4 3 4 4 4 4 4 4 4 4 3 4 3 3 4 3 4 4 4 3 4 4 4 4 3 3 3 4 3 3 4 4 3 4 4 3 4 4 3 3 3 3 3 3 3 3 3 4 4 4 3 3 3 3 3 3 4 3 4 3 ...
output:
99960007
result:
ok single line: '99960007'
Test #39:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
19998 10000 6 6 6 6 2 6 6 6 6 6 6 6 2 6 2 2 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 2 2 2 2 2 2 2 6 6 2 2 2 2 6 2 2 6 6 2 2 2 6 2 6 2 6 6 6 6 6 2 2 6 2 2 6 6 2 6 6 6 6 6 6 6 2 2 2 6 2 2 2 2 6 2 2 2 6 6 2 6 2 2 2 6 6 6 6 2 6 2 2 6 6 2 2 2 6 6 2 2 6 6 6 6 2 2 2 2 6 2 2 6 6 2 2 6 6 2 2 2 2 6 6 2 2 2 6 2 2 2 6 2 ...
output:
99950006
result:
ok single line: '99950006'
Test #40:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
19997 10000 4 5 5 4 5 4 5 5 4 4 4 5 5 4 5 4 4 4 5 5 5 4 5 4 5 4 4 4 1 5 4 4 5 5 5 5 5 4 4 4 5 5 5 4 5 4 5 5 4 5 4 5 4 4 4 4 4 4 5 5 5 4 4 4 4 5 4 4 5 4 5 5 5 4 5 5 4 5 4 5 5 4 4 4 4 5 5 5 4 4 4 5 4 4 4 4 4 4 5 4 4 4 4 5 5 5 4 4 4 5 4 5 4 5 5 5 5 4 5 4 4 5 5 5 4 4 5 5 5 4 5 5 5 5 4 4 5 5 5 4 4 5 4 5 ...
output:
99940013
result:
ok single line: '99940013'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
20000 9999 1 3 3 3 3 1 1 3 3 1 3 3 3 1 3 3 3 1 3 1 3 3 1 3 1 3 3 3 1 3 3 3 1 1 3 3 1 3 1 1 3 3 1 1 3 1 1 1 1 3 1 3 1 1 3 3 3 3 3 3 3 1 1 3 1 1 3 1 1 3 3 1 3 1 1 3 3 1 3 3 3 3 1 3 1 1 1 1 3 3 3 3 3 3 1 1 3 1 1 3 1 3 3 3 3 3 1 1 1 1 1 1 3 1 1 3 3 3 1 3 1 1 1 1 1 3 3 1 3 1 1 1 1 3 1 3 1 3 1 3 1 1 3 1 1...
output:
99970003
result:
ok single line: '99970003'
Test #42:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
19999 9999 3 2 3 3 3 2 3 2 3 2 3 2 3 3 2 3 2 2 3 3 2 3 3 3 3 2 2 2 3 2 3 3 3 3 3 2 3 2 2 2 2 3 2 3 3 3 3 3 3 2 3 3 3 2 3 3 2 3 2 3 3 3 3 3 3 2 2 3 2 3 3 2 3 2 2 3 2 2 3 2 2 2 3 3 3 2 3 2 2 3 2 3 3 2 2 3 3 2 2 3 2 3 2 3 3 2 2 2 3 2 3 2 2 3 2 2 2 2 2 3 2 2 2 2 3 3 3 2 3 3 2 3 3 2 3 2 3 2 3 2 3 2 2 3 3...
output:
99960006
result:
ok single line: '99960006'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
19998 9999 5 1 5 1 1 5 5 5 1 1 1 5 5 5 5 1 5 1 5 1 5 1 5 5 1 1 1 5 1 5 5 5 5 1 1 5 5 1 1 5 1 5 1 1 5 5 1 1 5 1 5 1 5 5 1 1 1 5 5 1 1 5 5 1 5 5 5 1 5 5 1 1 1 1 1 5 1 5 1 5 5 1 1 5 1 5 1 1 1 5 1 1 1 5 5 1 5 1 1 1 1 1 1 1 5 5 5 5 1 5 5 5 5 1 1 5 1 5 5 1 5 1 1 1 1 1 1 5 1 5 1 5 5 5 1 1 5 1 5 5 5 5 5 1 1...
output:
99950005
result:
ok single line: '99950005'
Test #44:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
19997 9999 4 3 3 4 4 3 3 4 4 4 3 3 3 3 3 3 4 4 3 3 3 3 4 4 3 4 4 4 4 4 4 3 3 4 3 4 3 3 4 4 4 3 3 3 3 4 4 4 3 3 3 3 3 4 3 4 3 4 4 3 4 4 3 3 4 4 4 4 4 3 4 3 3 3 4 3 4 3 4 3 4 4 3 3 3 4 3 3 3 3 4 4 4 4 4 3 4 4 4 3 4 3 4 3 3 4 4 4 3 4 3 3 3 4 4 4 4 3 3 3 4 3 3 3 4 3 4 4 4 4 4 3 4 4 3 4 3 3 3 4 4 4 4 4 3...
output:
99940012
result:
ok single line: '99940012'
Test #45:
score: 0
Accepted
time: 1ms
memory: 3740kb
input:
19999 9998 2 2 1 2 2 1 2 1 2 2 2 2 1 2 1 1 1 1 1 2 2 1 2 2 2 1 1 2 1 2 1 2 2 1 1 1 2 1 2 1 1 2 2 1 2 1 2 1 1 2 2 2 2 2 1 2 1 1 1 2 1 1 1 2 2 1 1 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 1 1 1 1 1 2 1 1 2 2 1 1 1 1 2 2 2 2 1 2 2 2 2 2 1 1 1 1 2 2 1 1 2 1 1 2 2 2 1 1 1 1 2 1 1 2 1 2 2...
output:
99960005
result:
ok single line: '99960005'
Test #46:
score: 0
Accepted
time: 1ms
memory: 3704kb
input:
19997 9998 2 2 2 2 3 2 2 3 3 2 3 2 3 3 2 3 3 2 3 3 2 2 2 2 3 2 3 3 3 3 2 3 2 3 3 3 3 3 3 2 3 3 2 2 2 2 3 3 3 3 3 3 3 3 2 2 3 3 3 2 3 2 3 2 2 2 2 2 2 3 3 2 3 2 2 2 2 3 3 2 3 2 2 2 2 3 2 3 3 3 3 3 2 3 3 2 3 2 3 2 3 3 2 3 3 2 3 3 3 2 2 2 3 2 3 3 2 3 3 3 2 3 2 3 3 3 2 2 2 2 2 3 3 3 2 3 3 2 2 3 2 3 2 3 2...
output:
99940011
result:
ok single line: '99940011'
Test #47:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
19996 9998 2 2 2 4 4 4 2 4 4 2 2 4 2 4 2 2 2 4 2 2 4 2 4 2 2 2 4 2 2 4 2 4 2 2 4 4 2 2 2 4 2 2 2 2 4 2 4 2 2 4 2 2 2 4 2 2 2 4 4 2 2 2 4 4 2 4 4 4 4 4 4 4 2 4 4 2 2 4 4 2 4 2 4 2 4 2 2 2 4 4 4 4 4 2 2 4 4 4 2 2 2 2 2 2 4 2 2 4 4 2 2 4 4 4 4 2 2 4 2 2 2 2 2 4 4 4 4 2 2 4 4 2 2 4 4 2 4 2 4 4 4 2 2 4 4...
output:
99930014
result:
ok single line: '99930014'
Test #48:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
19995 9998 4 4 3 4 3 3 3 3 3 3 3 3 4 4 4 3 4 3 4 3 4 3 3 3 4 3 4 4 4 3 3 3 4 4 3 4 4 4 4 3 4 3 4 3 3 3 4 4 3 4 4 3 4 3 3 3 3 3 4 3 3 4 3 4 4 3 4 4 3 4 4 4 4 4 3 4 3 3 4 4 4 4 4 3 3 3 3 3 4 3 3 3 4 4 4 3 3 4 3 4 4 3 4 4 4 4 4 4 3 3 4 4 4 4 3 3 3 4 3 4 3 4 4 4 3 4 4 3 3 3 3 4 4 3 4 4 4 4 4 4 3 4 4 3 4...
output:
99920019
result:
ok single line: '99920019'
Test #49:
score: 0
Accepted
time: 1ms
memory: 3824kb
input:
19997 9997 2 1 2 1 1 1 2 1 2 1 2 1 1 1 1 1 1 2 2 1 1 2 2 1 2 2 1 2 1 2 2 2 2 1 2 2 2 2 1 2 1 1 1 1 2 1 1 1 2 1 1 2 1 2 1 1 1 2 2 2 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 1 2 1 1 2 1 1 2 1 2 2 1 1 1 2 2 2 2 2 2 1 2 1 1 1 2 1 1 1 1 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 2 2 2 2 2 2 2 2 1 2 2 1 2 1 2 2 2 1 1 2 2 1 1...
output:
99940010
result:
ok single line: '99940010'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3692kb
input:
19996 9997 1 3 1 3 1 1 3 1 3 3 3 1 1 3 3 1 1 1 1 1 3 3 1 3 3 1 3 1 3 3 1 1 1 1 3 3 1 1 1 1 1 1 1 1 3 1 1 1 3 3 1 3 1 3 1 3 3 1 1 3 3 3 1 1 3 1 3 1 3 3 1 1 3 1 1 1 1 3 1 1 1 3 3 3 1 3 3 1 3 3 3 1 3 3 3 1 3 3 3 1 3 3 3 3 3 3 3 1 3 3 1 3 1 1 1 3 1 1 3 3 3 1 1 3 1 3 3 3 1 3 1 3 3 1 1 1 3 3 3 3 1 3 1 1 3...
output:
99930013
result:
ok single line: '99930013'
Test #51:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
19995 9997 2 2 2 3 2 2 3 2 3 3 2 2 3 2 3 3 3 3 3 2 2 2 3 3 3 2 2 2 2 2 2 2 2 2 3 3 3 2 2 3 3 2 2 3 3 2 3 2 2 3 2 3 2 3 3 2 2 3 2 2 3 3 2 2 3 2 3 3 2 2 3 2 3 2 2 2 3 2 3 3 3 2 2 2 2 2 3 3 3 3 2 2 3 3 2 2 3 3 3 2 3 2 3 3 2 3 3 2 3 2 2 3 3 2 2 2 2 3 3 3 3 2 3 2 2 2 2 3 2 3 3 2 2 2 3 2 3 3 3 2 2 3 2 3 3...
output:
99920018
result:
ok single line: '99920018'
Test #52:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
19994 9997 5 5 1 1 5 1 5 5 1 1 5 5 1 5 1 1 5 5 1 1 1 1 1 1 5 5 1 1 1 5 1 1 1 1 1 1 5 5 5 5 5 1 5 5 1 1 1 1 5 5 5 5 1 5 1 5 5 5 1 1 5 1 1 1 1 5 5 5 5 5 1 5 1 5 5 1 5 5 5 1 5 1 1 5 1 5 1 1 1 5 1 1 5 1 1 5 1 5 5 1 1 1 5 1 1 5 1 1 5 5 5 5 1 1 5 1 1 5 5 1 1 1 5 5 1 5 1 1 5 5 1 1 1 5 1 1 5 5 1 5 1 1 5 1 1...
output:
99910019
result:
ok single line: '99910019'
Test #53:
score: 0
Accepted
time: 345ms
memory: 4364kb
input:
20000 10000 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:
74992501
result:
ok single line: '74992501'
Test #54:
score: 0
Accepted
time: 428ms
memory: 4424kb
input:
20000 10000 1 1 1 1 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 5...
output:
50014996
result:
ok single line: '50014996'
Test #55:
score: 0
Accepted
time: 285ms
memory: 4292kb
input:
13472 10000 2683 1746 4333 1345 4617 8807 215 4555 2180 1870 6638 4088 4438 4504 506 9997 780 4072 4837 5346 669 4045 3553 1249 4299 3355 3348 1225 5527 1571 4619 6203 563 6325 1625 2916 6574 430 4687 514 562 4056 4549 4946 5853 3015 4050 2827 2813 2664 1069 4866 2863 9439 6448 878 1204 8932 239 527...
output:
41794452
result:
ok single line: '41794452'
Test #56:
score: 0
Accepted
time: 355ms
memory: 4304kb
input:
20000 10000 1 1 1 1 1 9998 9998 9998 9998 9998 9998 9995 9995 9995 9995 9995 9995 9992 9992 9992 9992 9992 9992 9989 9989 9989 9989 9989 9989 9986 9986 9986 9986 9986 9986 9983 9983 9983 9983 9983 9983 9980 9980 9980 9980 9980 9980 9977 9977 9977 9977 9977 9977 9974 9974 9974 9974 9974 9974 9971 997...
output:
50005007
result:
ok single line: '50005007'
Test #57:
score: 0
Accepted
time: 357ms
memory: 4428kb
input:
19999 10000 1 1 1 1 1 9998 9998 9998 9998 9998 9998 9995 9995 9995 9995 9995 9995 9992 9992 9992 9992 9992 9992 9989 9989 9989 9989 9989 9989 9986 9986 9986 9986 9986 9986 9983 9983 9983 9983 9983 9983 9980 9980 9980 9980 9980 9980 9977 9977 9977 9977 9977 9977 9974 9974 9974 9974 9974 9974 9971 997...
output:
50000012
result:
ok single line: '50000012'
Test #58:
score: 0
Accepted
time: 77ms
memory: 4284kb
input:
4495 10000 3479 4622 3230 698 4727 4991 5486 500 590 254 8444 3374 4919 2864 5027 3464 1091 8972 1154 953 3410 3272 557 8741 569 3119 4457 398 4607 2702 5324 2069 1940 4394 1295 1784 2882 4715 1361 4247 1376 3578 4121 1454 5567 1925 3224 4712 3473 2240 1211 4400 488 1442 1313 4169 1022 1268 3356 160...
output:
13943496
result:
ok single line: '13943496'