QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#88179 | #5378. 匹配问题 | tricyzhkx | 100 ✓ | 476ms | 19660kb | C++14 | 1.9kb | 2023-03-15 14:23:13 | 2023-03-15 14:23:14 |
Judging History
answer
# include <bits/stdc++.h>
using namespace std;
int n,a[500010],b[500010],lim[500010],minn[1100000],tag[1100000];
struct BIT
{
int s[500010];
void init(){for(int i=1;i<=n;i++) s[i]=i&(-i);}
void update(int x){for(int i=x;i<=n;i+=i&(-i)) s[i]--;}
int query(int k)
{
int ans=0,cur=0;
for(int i=__lg(n);i>=0;i--)
if(ans+(1<<i)<=n && cur+s[ans+(1<<i)]<=k)
ans+=1<<i,cur+=s[ans];
return ans;
}
}B;
void build(int rt,int l,int r)
{
if(l==r) return minn[rt]=l-lim[l],void();
int mid=(l+r)/2;
build(rt*2,l,mid);build(rt*2+1,mid+1,r);
minn[rt]=min(minn[rt*2],minn[rt*2+1]);
}
void push(int rt,int t){tag[rt]+=t;minn[rt]-=t;}
void pushdown(int rt)
{
if(!tag[rt]) return;
push(rt*2,tag[rt]);push(rt*2+1,tag[rt]);
tag[rt]=0;
}
void update(int rt,int l,int r,int x)
{
if(l==r) return minn[rt]=1e9,void();
pushdown(rt);
int mid=(l+r)/2;
if(x<=mid) update(rt*2,l,mid,x);
else update(rt*2+1,mid+1,r,x);
minn[rt]=min(minn[rt*2],minn[rt*2+1]);
}
void update(int rt,int l,int r,int x,int y)
{
if(l>y || r<x) return;
if(x<=l && r<=y) return push(rt,1);
pushdown(rt);
int mid=(l+r)/2;
update(rt*2,l,mid,x,y);update(rt*2+1,mid+1,r,x,y);
minn[rt]=min(minn[rt*2],minn[rt*2+1]);
}
int query(int rt,int l,int r,int x,int y)
{
if(l>y || r<x) return 1e9;
if(x<=l && r<=y) return minn[rt];
pushdown(rt);
int mid=(l+r)/2;
return min(query(rt*2,l,mid,x,y),query(rt*2+1,mid+1,r,x,y));
}
int main()
{
int La,Lb,ans=0;
cin>>n>>La>>Lb;
for(int i=1;i<=n;i++) scanf("%d",&a[i]);
for(int i=1;i<=n;i++) scanf("%d",&b[i]);
sort(a+1,a+n+1);sort(b+1,b+n+1);
for(int i=1,j=1;i<=n;i++)
{
for(;j<=n && b[i]>a[j]+La;j++);
lim[i]=j;
}
B.init();build(1,1,n);
for(int i=n,j=n;i>=1;i--)
{
for(;j && b[j]>a[i]+Lb;j--);
if(!j || b[j]<a[i]) continue;
int k=B.query(i);
if(query(1,1,n,j+1,k)<=0) continue;
update(1,1,n,j+1,k);update(1,1,n,j);
B.update(j--);ans++;
}
cout<<ans<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 4
Accepted
Test #1:
score: 4
Accepted
time: 0ms
memory: 3512kb
input:
2 2 1 1 1 1 1
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10 200000 100000 34181 300096 24293 22680 402306 193269 438170 254676 188147 73971 216849 477743 461911 135785 467234 278230 287107 223666 124173 135091
output:
7
result:
ok single line: '7'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3480kb
input:
10 200000 50000 298370 136488 436143 52173 206095 140981 321188 407844 342157 193338 138374 383207 156748 442404 386749 492604 354156 229996 447123 418264
output:
5
result:
ok single line: '5'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
10 50000 30000 306273 53088 405351 218373 335275 277816 451436 105244 418031 83336 489843 323727 219514 102964 141689 337190 131790 312365 431836 413688
output:
5
result:
ok single line: '5'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3432kb
input:
10 80000 60000 224299 63826 419731 459681 408367 139676 239118 115180 368327 179613 289195 106688 418781 143169 441337 255686 228353 373168 489321 173199
output:
10
result:
ok single line: '10'
Test #6:
score: 0
Accepted
time: 3ms
memory: 3672kb
input:
10 150000 80000 218617 21495 443909 77126 349241 169574 387539 106419 251533 138042 427196 237082 192262 56014 357102 109789 495939 197573 273744 498979
output:
7
result:
ok single line: '7'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3496kb
input:
10 5 1 1 28 22 4 16 13 7 10 19 25 6 9 27 12 30 24 18 15 3 21
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3364kb
input:
10 2 1 19 13 16 22 28 25 7 1 4 10 6 21 30 9 15 12 27 18 3 24
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3432kb
input:
9 5 1 9 1 12 2 16 5 8 15 19 18 20 4 7 14 6 21 13 11
output:
3
result:
ok single line: '3'
Test #10:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
10 500000 1 13 1 16 4 22 7 10 28 25 19 9 3 30 18 24 15 6 20 27 12
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
3 2 1 1 2 3 3 4 5
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
10 500000 499999 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282 375282
output:
10
result:
ok single line: '10'
Subtask #2:
score: 14
Accepted
Dependency #1:
100%
Accepted
Test #13:
score: 14
Accepted
time: 0ms
memory: 3508kb
input:
100 200000 50000 216198 375994 364079 318600 289827 26059 302540 179976 362307 239456 310052 149745 283732 189278 465297 19986 492322 62889 399607 354136 103590 327594 335929 428453 474630 362205 113883 219196 488463 150086 144585 8342 98764 454065 282581 397786 274728 271563 326538 246226 384730 25...
output:
63
result:
ok single line: '63'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
100 200000 10000 480821 383273 197373 419379 37439 203333 299170 472531 243830 178320 365484 188981 414062 72193 411592 424204 340704 77915 241035 418858 18916 22153 349730 52029 216408 254012 239845 340707 326325 217780 49620 457023 424881 447611 180529 299451 97390 388124 62096 217848 229883 36748...
output:
50
result:
ok single line: '50'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
100 200000 5000 248114 369741 180383 287869 440522 23446 77242 341565 270689 231933 318395 106083 425489 353655 339921 86901 464488 473163 90027 262555 343418 64735 38062 128873 201978 157259 398800 244502 277724 193275 415958 252223 338307 425455 385803 408262 493113 470196 456942 87927 48611 13535...
output:
48
result:
ok single line: '48'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
100 100000 50000 486345 297886 26025 474314 100979 481518 11500 283550 332460 445057 17533 144840 221191 392737 115392 302986 454624 423360 16963 446798 30332 270733 1813 396977 352733 134622 233480 413553 229390 162339 373438 159455 456285 111216 188711 265590 452306 73 124816 278925 143310 283361 ...
output:
82
result:
ok single line: '82'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3320kb
input:
100 100000 5000 439157 15849 342210 416475 203400 331705 267562 496741 5582 1527 80269 362890 93819 325171 471805 492364 426232 179298 212402 373335 320351 280366 363315 268413 180120 228943 308449 335872 155669 7017 449849 234951 12715 258464 24847 476960 498347 331138 484617 468028 15269 307198 34...
output:
43
result:
ok single line: '43'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3424kb
input:
100 50000 5000 356138 75991 429667 167698 190384 320685 49056 231155 493359 58606 294380 305694 417163 211543 183439 211048 241022 110826 325734 464543 194473 243735 16536 155717 338096 404192 189355 169201 133506 495056 164315 116861 112397 262901 303833 236119 52989 331273 270007 359116 2070 25260...
output:
41
result:
ok single line: '41'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
100 50000 7000 278750 385984 434621 58472 322689 269436 245170 17244 456888 11920 210805 31811 289511 463364 155357 467516 459079 191267 396040 454082 460194 103191 92335 494144 114187 326720 309988 123829 214131 141758 455879 416627 2031 134103 431343 325594 81548 358209 273302 421176 259867 446631...
output:
46
result:
ok single line: '46'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3512kb
input:
100 50000 10000 44671 199153 486351 64506 331287 386915 95122 54209 376550 139713 371612 188414 388792 75322 179157 370318 183962 317192 183394 351017 304929 390544 253896 334074 275884 159986 348155 8929 192946 258068 419481 63725 327275 244648 58851 289296 385871 201431 40630 255845 261638 230397 ...
output:
40
result:
ok single line: '40'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
100 30000 5000 370274 110702 441251 272581 129801 352167 122734 60816 261473 2126 292718 151986 8139 321067 83913 278084 103390 203161 32695 280737 164143 431372 197003 71699 61831 174258 38384 56872 419945 197154 204290 148171 337649 346984 294808 178731 381524 299625 285955 237110 425019 130281 24...
output:
36
result:
ok single line: '36'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
100 30000 8000 251366 436756 233765 308050 194657 435426 433129 386977 140841 136428 356400 496170 57335 389627 375625 184631 255361 454672 119519 334233 383164 157349 100449 15554 66998 57625 234164 79397 327508 375708 319035 322094 266219 56301 245907 52931 256785 32213 367928 157824 467045 49924 ...
output:
49
result:
ok single line: '49'
Test #23:
score: 0
Accepted
time: 1ms
memory: 3440kb
input:
100 20000 10000 214869 191290 19116 251609 491675 223459 457066 63933 189882 450667 343040 67504 433800 357884 11077 254264 429652 49101 262977 349432 333510 236391 383768 216721 363804 214450 456066 61650 170593 294394 37815 62425 405074 488694 194382 476654 123487 152483 247976 339464 430823 10631...
output:
65
result:
ok single line: '65'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
100 20000 5000 437462 329536 281051 49656 311386 383880 414050 304141 222086 464737 473489 111375 486227 33389 425895 173908 13428 333673 416322 248683 193081 170119 7585 258089 30268 462767 229201 424598 229857 498012 391803 83729 496967 399202 254599 55990 344248 65292 466212 268316 439263 329296 ...
output:
35
result:
ok single line: '35'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
100 20000 8000 186991 153145 224998 168406 333689 14632 43352 351492 312667 7271 450525 115816 251856 477325 64515 195920 60688 271020 155268 30582 63814 316250 14753 299856 424233 33441 328071 95459 447508 188164 355273 77339 155202 373087 447826 215904 212918 277562 304754 31015 4340 350427 250433...
output:
52
result:
ok single line: '52'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
100 20000 15000 44059 345504 396488 324911 213580 103158 409930 350640 488727 232174 193116 195392 481090 498251 410616 438595 455380 289496 327872 112377 139575 216353 343918 272424 127610 59561 247654 479113 123751 28485 333387 158487 420901 114134 490297 130126 23097 287176 146717 282195 283608 1...
output:
88
result:
ok single line: '88'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
100 8000 6000 300083 476523 482608 21733 28565 486450 130857 230311 413484 166500 162587 260465 293137 250677 91590 495361 213360 89633 310942 46372 284836 308066 312348 22024 254554 461569 41723 400947 197082 286616 390455 302256 462378 481962 455426 45603 457483 404009 279406 207812 461602 279234 ...
output:
78
result:
ok single line: '78'
Test #28:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
100 8000 3000 349688 110364 204130 261795 399833 443387 7687 397959 231285 426706 308452 125270 252485 405799 90 6212 392185 196397 230660 90964 309814 58734 321188 94974 274155 258035 133847 137190 142104 270143 419182 422564 131482 172427 436081 120129 165426 468786 292634 422791 107056 157405 394...
output:
47
result:
ok single line: '47'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
100 8000 5000 432732 28718 32127 157910 400081 293228 282303 467763 177603 377587 436200 15806 290625 208627 320226 295877 97340 275915 225419 227052 425917 326666 203460 408584 69791 222820 24515 254501 384537 56310 391749 32870 230072 142265 218590 430854 215072 28096 199398 235671 96365 493361 48...
output:
70
result:
ok single line: '70'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
100 20000 7500 265668 267070 51164 288683 360507 70115 344194 159434 288683 288683 118552 204469 495058 260491 455254 288683 161325 148274 141485 316912 356624 270993 288683 270981 456336 288683 494888 243289 454834 386616 288683 160061 288683 102794 309555 179758 414065 480849 415057 288683 204579 ...
output:
65
result:
ok single line: '65'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
100 40000 12000 148990 264865 225361 15902 148990 387814 368692 148990 358572 154517 148990 148990 148990 148990 114698 148990 148990 148990 461229 148990 148990 148990 447993 166967 63548 148990 375511 149289 148990 148990 497498 148990 442420 148990 168189 295994 148990 148990 326163 457297 148990...
output:
76
result:
ok single line: '76'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3664kb
input:
100 5 1 220 274 166 49 133 19 7 91 40 67 286 73 142 58 229 13 280 31 295 199 100 43 97 217 190 202 139 1 79 172 148 283 127 178 181 64 25 16 253 37 151 154 268 85 4 223 106 103 61 298 112 22 130 214 211 28 193 115 289 163 169 196 226 121 184 82 76 55 265 124 109 52 157 262 241 247 235 205 238 88 70 ...
output:
0
result:
ok single line: '0'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3540kb
input:
100 2 1 199 214 271 253 274 262 289 16 181 1 76 250 88 298 19 232 190 85 175 178 7 79 172 133 202 142 166 259 187 34 136 241 286 13 31 28 112 226 43 205 127 40 52 4 67 220 139 208 151 229 10 25 121 292 277 295 49 148 97 115 160 82 145 196 268 100 193 184 256 244 265 91 247 163 157 238 64 109 235 283...
output:
0
result:
ok single line: '0'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
99 5 1 226 120 145 2 40 222 71 134 194 92 93 103 152 89 106 163 58 110 187 44 169 211 156 176 29 215 37 65 148 219 183 47 127 173 43 197 124 117 205 180 33 201 99 135 82 1 208 79 149 128 142 64 198 9 190 113 5 229 75 19 212 72 170 159 61 50 177 36 100 218 78 12 131 162 51 26 141 57 16 23 155 107 191...
output:
33
result:
ok single line: '33'
Test #35:
score: 0
Accepted
time: 2ms
memory: 3596kb
input:
100 500000 1 292 154 187 4 52 286 91 172 250 118 121 133 196 298 136 211 76 142 241 58 217 271 202 226 37 277 49 85 190 283 235 61 163 223 55 253 160 151 265 232 43 259 127 175 106 1 268 103 193 166 184 82 256 13 244 145 7 295 97 25 274 94 220 205 79 64 229 46 130 280 100 16 169 208 67 34 181 73 22 ...
output:
1
result:
ok single line: '1'
Test #36:
score: 0
Accepted
time: 2ms
memory: 3368kb
input:
100 2000 500 418148 67772 425443 340480 340480 340480 340480 340480 340480 316215 294520 338888 340480 100549 115089 340480 107308 340480 340480 340480 340480 340480 174618 18800 340480 301568 340480 340480 340480 340480 232718 340480 340480 259501 295002 340480 340480 138230 340480 41270 340480 194...
output:
66
result:
ok single line: '66'
Test #37:
score: 0
Accepted
time: 2ms
memory: 3520kb
input:
100 2000 300 377953 322264 413478 413478 376432 413478 413478 334955 233334 66253 413478 304735 413478 413478 21922 413478 413478 413478 413478 161562 413478 413478 413478 413478 91165 413478 460936 413478 418372 262631 413478 352490 224110 276955 413478 191376 39467 56781 413478 413478 460179 41347...
output:
58
result:
ok single line: '58'
Test #38:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
100 1300 500 275326 32201 43613 32201 32201 32201 32201 32201 32201 32201 109685 32201 32201 32201 317745 32201 32201 32201 32201 32201 481269 100696 214472 32201 10494 38972 434257 258191 32201 32201 32201 330759 461123 184513 312960 401127 32201 32201 379885 150822 32201 44681 150926 402532 20978 ...
output:
66
result:
ok single line: '66'
Test #39:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
100 1300 300 105199 105199 135094 238839 105199 105199 105199 105199 105199 114122 190730 105199 105199 251539 438687 80445 105199 400921 105199 105199 105199 105199 105199 105199 105199 105199 431617 105199 105199 469254 123139 350126 6811 372888 360852 93084 199402 105199 105199 105199 105199 1051...
output:
65
result:
ok single line: '65'
Test #40:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
100 2000 80 332966 226626 332966 225313 332966 332966 183595 332966 233583 332966 379780 449197 366550 332966 174233 332966 309128 332966 332966 199315 332966 43405 406348 455211 332966 332966 332966 110679 311635 332966 332966 332966 487496 332966 385059 332966 223471 239312 387602 332966 332966 10...
output:
54
result:
ok single line: '54'
Test #41:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
100 2000 130 384497 481777 50122 20784 343979 343979 398541 259243 65525 110266 343979 343979 343979 248299 343979 343979 343979 343979 493144 343979 452004 343979 343979 343979 343979 343979 150234 377797 196132 343979 343979 29893 424743 69112 343979 343979 229115 343979 343979 450379 343979 42121...
output:
55
result:
ok single line: '55'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
100 1300 50 397272 101950 473518 17739 473518 473518 473518 468065 250285 473518 166170 473518 473518 184167 224701 193447 473518 473518 473518 318583 222407 473518 317358 473518 473518 473518 473518 14161 473518 473518 100624 473518 473518 176415 473518 113482 462613 473518 449088 473518 473518 259...
output:
50
result:
ok single line: '50'
Test #43:
score: 0
Accepted
time: 2ms
memory: 3440kb
input:
100 1300 100 435913 93884 217777 145492 145492 280703 145492 340217 43451 145492 145492 314747 351065 340743 145492 145492 145492 477577 145492 176153 145492 284890 13898 145492 432377 145492 145492 235162 219042 145492 488155 145492 145492 145492 467400 299157 145492 145492 145492 142783 145492 145...
output:
52
result:
ok single line: '52'
Test #44:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
100 2000 1000 131926 62202 165169 131926 131926 393587 7138 46568 131926 131926 131926 131926 396926 234879 131926 131926 131926 328546 131926 131926 37402 328699 300984 456035 160067 400781 65346 131926 131926 131926 179303 331672 131926 186742 131926 131926 131926 250103 131926 131926 131926 21872...
output:
73
result:
ok single line: '73'
Test #45:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
100 1300 700 459203 224768 459203 459203 459203 459203 459203 172480 209823 23 459203 459203 459203 459203 459203 203877 459203 459203 399243 459203 445094 390194 51075 459203 29023 459203 235059 315626 459203 459203 408210 300568 24624 459203 459203 223172 459203 397353 277240 459203 459203 459203 ...
output:
75
result:
ok single line: '75'
Test #46:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
3 2 1 1 2 3 3 4 5
output:
0
result:
ok single line: '0'
Test #47:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
100 500000 499999 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 176385 17...
output:
100
result:
ok single line: '100'
Subtask #3:
score: 37
Accepted
Dependency #2:
100%
Accepted
Test #48:
score: 37
Accepted
time: 2ms
memory: 3528kb
input:
5000 233332 10000 421792 375018 481154 336831 239001 405616 387728 193044 450941 324370 238058 90659 431129 164919 47539 459063 498299 50838 171390 288397 159733 478192 6313 157409 366112 335593 328170 245357 341333 328352 250456 17602 438402 281715 81204 117468 456833 337362 432232 186808 408980 44...
output:
2973
result:
ok single line: '2973'
Test #49:
score: 0
Accepted
time: 5ms
memory: 3876kb
input:
5000 200000 100000 463972 56767 110693 292681 499566 41997 404179 244788 168434 455510 181483 119385 230325 255774 31791 162590 237076 440750 144186 459644 25418 393933 200590 3860 419876 374095 174245 423036 434239 95121 302917 418831 446448 140289 346795 283524 124706 199600 65161 276828 239470 36...
output:
4969
result:
ok single line: '4969'
Test #50:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
5000 200000 50000 390962 366941 47056 264653 117656 198976 254472 398425 456087 371287 236591 2258 5679 403623 464839 39953 214394 225500 163063 21966 12942 99235 180052 145749 110806 243882 436329 212301 178355 385664 382160 165605 47030 280986 233711 244374 195242 101972 146181 395092 5192 211774 ...
output:
3742
result:
ok single line: '3742'
Test #51:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
5000 200000 5000 412170 439436 423195 109785 446995 279063 261657 305828 405878 469830 250956 310049 58169 123746 458586 322197 276326 297809 50860 400354 179442 405807 358054 240050 268671 87055 12503 2895 261404 412130 390958 1991 235872 371126 134045 359202 31136 180095 180545 363632 223780 35317...
output:
2909
result:
ok single line: '2909'
Test #52:
score: 0
Accepted
time: 2ms
memory: 3876kb
input:
5000 200000 2000 86255 269733 470311 241609 370510 121746 16392 175001 857 302917 22537 227703 238055 141526 55297 228844 494741 183338 85915 435314 161970 194007 314244 57427 477283 204491 274489 293563 251994 318878 194836 404172 403414 202276 160305 408009 307402 237847 469358 305925 313829 44507...
output:
2820
result:
ok single line: '2820'
Test #53:
score: 0
Accepted
time: 4ms
memory: 3732kb
input:
5000 200000 8000 55319 472639 257094 420744 97206 377271 144238 75067 282580 331367 98069 28481 323234 491424 429932 296328 309663 390086 299578 329614 318774 273824 431663 437020 277997 205917 449171 269254 96207 263888 305054 28236 176350 217017 418469 355861 140875 163612 39349 82422 192430 23006...
output:
2872
result:
ok single line: '2872'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
5000 200000 20000 364777 99315 204678 453818 247564 93495 277220 368164 358536 44339 219166 429748 65704 304360 179252 417418 209106 407076 291702 398044 444937 18482 273224 480051 47306 166303 437761 271816 491353 342394 329193 346156 372214 285652 57848 445253 391374 170311 475239 262609 383220 13...
output:
3087
result:
ok single line: '3087'
Test #55:
score: 0
Accepted
time: 2ms
memory: 3844kb
input:
5000 200000 40000 72067 110481 263797 36637 290527 402012 162424 277517 331046 473231 105780 386456 185137 236418 263441 185006 148716 423368 183813 37872 111666 226918 70103 74307 336942 5159 409237 57493 118722 367955 157865 743 132814 497385 411056 192241 63513 15724 220351 136307 310182 53927 25...
output:
3524
result:
ok single line: '3524'
Test #56:
score: 0
Accepted
time: 5ms
memory: 3860kb
input:
5000 100000 50000 102920 441021 140300 251197 293853 231473 279326 274320 126824 176024 368042 27936 19396 343134 190006 271901 107608 427720 418562 343604 11564 253791 462233 369046 437649 380683 400009 440122 257989 366851 34567 298271 298795 91732 55603 326997 278203 452272 74873 36827 149663 102...
output:
4888
result:
ok single line: '4888'
Test #57:
score: 0
Accepted
time: 4ms
memory: 3576kb
input:
5000 100000 5000 473763 116865 466007 147529 444751 158381 393699 85889 330439 396004 303283 4445 118318 46596 409166 89897 445084 187858 395557 422104 341560 370603 27103 497263 181064 411102 143981 115217 415359 61384 110414 341073 304073 274642 47110 206510 69678 240507 441496 405292 463064 41616...
output:
2786
result:
ok single line: '2786'
Test #58:
score: 0
Accepted
time: 5ms
memory: 3684kb
input:
5000 100000 2000 43548 272158 34671 252439 66145 386375 246273 56615 156058 47562 299199 31644 251665 221113 498334 65805 159449 53968 102856 157441 408288 88943 164156 123142 27117 393201 77127 266363 109450 111311 217449 27313 281000 364199 376408 287202 23578 173909 147899 264580 139168 142218 36...
output:
2698
result:
ok single line: '2698'
Test #59:
score: 0
Accepted
time: 2ms
memory: 3860kb
input:
5000 100000 8000 419995 119296 337902 470746 229116 340649 470876 498496 472717 96683 261124 260984 371991 238429 165943 132692 426756 109715 408045 363621 490458 380961 220755 433872 177738 250359 54218 197665 369973 298073 262499 102804 248019 171918 231185 350148 68209 452465 130881 350203 152260...
output:
2880
result:
ok single line: '2880'
Test #60:
score: 0
Accepted
time: 5ms
memory: 3640kb
input:
5000 100000 20000 331402 331507 396897 237358 153764 287567 7956 161038 465314 99515 327003 173845 117432 219850 32541 122560 253212 195102 22362 61766 425978 201996 342663 213437 47997 332716 168107 378825 291933 16618 412535 474929 7730 497258 98690 133416 238830 135699 61631 17675 175715 96074 33...
output:
3281
result:
ok single line: '3281'
Test #61:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
5000 100000 40000 327322 162909 132466 255759 417172 139794 72052 155630 65598 428083 289132 261492 318169 430123 356475 66706 344890 273251 339303 262439 220945 19698 264354 476734 1516 291854 387696 353722 11807 205602 196906 411932 222978 200551 267172 228569 230406 308868 262872 434985 22164 376...
output:
4231
result:
ok single line: '4231'
Test #62:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
5000 50000 5000 69026 208262 170986 68305 356687 264015 471340 447592 226233 318998 90722 201767 176971 278958 450079 124961 478942 286884 356392 114120 448595 475580 404523 215718 292196 182892 321391 143598 176260 340620 362421 319332 243386 246333 4454 396554 53025 241093 21696 156000 138251 1131...
output:
2803
result:
ok single line: '2803'
Test #63:
score: 0
Accepted
time: 5ms
memory: 3644kb
input:
5000 50000 2000 361766 217345 259095 495419 175387 31709 110220 164187 11681 85054 395431 135149 305834 176625 455726 159689 301690 299390 132113 35627 187421 29462 95083 72584 69408 177695 230285 353128 246763 371903 55747 70250 370263 319135 177728 171772 339003 210144 185259 209215 245358 439787 ...
output:
2649
result:
ok single line: '2649'
Test #64:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
5000 50000 8000 312531 287967 167638 126803 172266 242033 462787 331114 6169 301115 470650 494275 452868 330086 367809 84589 295957 21080 291903 452338 319314 478023 453121 231714 164547 112754 52761 175097 451457 379376 304072 231578 320601 391081 74521 133176 224230 50043 114041 432691 391664 1538...
output:
3037
result:
ok single line: '3037'
Test #65:
score: 0
Accepted
time: 2ms
memory: 3876kb
input:
5000 50000 20000 352343 444456 129455 63036 415631 405431 466537 342473 73146 80102 43126 499679 319403 261245 76721 264983 277802 489576 304115 69911 110120 150286 255062 381910 131570 189777 297781 338087 9913 309686 341014 465524 274999 497931 33541 346751 185370 94873 111072 19201 261981 272024 ...
output:
4119
result:
ok single line: '4119'
Test #66:
score: 0
Accepted
time: 5ms
memory: 3712kb
input:
5000 50000 40000 424107 164537 282708 485149 321650 88866 456420 106651 173479 11164 462137 116954 108534 62019 100990 467976 460384 264636 96576 112352 216158 295581 194102 51250 133396 271379 103107 2084 22443 318896 263284 380149 58258 296446 415694 26971 99671 38788 288414 381636 56956 367303 38...
output:
5000
result:
ok single line: '5000'
Test #67:
score: 0
Accepted
time: 5ms
memory: 3804kb
input:
5000 20000 5000 337272 340625 335483 210758 476956 333570 416793 199881 5845 73765 473389 243290 301723 302633 26074 229792 209037 56226 401299 84169 81845 178781 424003 134426 97015 293790 173214 164014 318916 429958 249354 265021 177108 74317 149985 284078 18215 890 217276 408727 397326 32214 4062...
output:
3246
result:
ok single line: '3246'
Test #68:
score: 0
Accepted
time: 2ms
memory: 3800kb
input:
5000 20000 2000 497025 413399 30446 118074 287662 400170 18984 353428 162406 404751 286934 45796 165002 147839 498299 185485 345381 203754 384237 491910 293619 252900 295664 27345 249875 358149 392380 84692 254186 145878 37747 403856 252329 4461 339818 241060 495922 89663 104042 491639 370932 198396...
output:
2700
result:
ok single line: '2700'
Test #69:
score: 0
Accepted
time: 2ms
memory: 3640kb
input:
5000 20000 8000 350913 18858 428681 33 58527 394946 379187 74094 363699 498320 204842 269122 220990 102538 94665 146593 110642 116922 231251 368022 403325 164638 37274 282168 206042 393002 322920 406754 349854 410957 273427 394393 438977 444757 354065 78841 359761 188774 5684 288484 171108 139292 44...
output:
4015
result:
ok single line: '4015'
Test #70:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
5000 20000 1000 472866 246458 18382 128253 379646 373796 57109 142428 185206 58553 372520 420556 57622 328272 376432 208664 149367 315792 224306 473081 135069 67999 75729 452060 63628 4242 424037 310609 433198 472362 244932 289569 408950 12383 292460 321100 201019 387870 423502 104770 215566 471878 ...
output:
2548
result:
ok single line: '2548'
Test #71:
score: 0
Accepted
time: 5ms
memory: 3576kb
input:
5000 20000 5100 210281 76586 413032 355318 48105 264599 414001 285955 143233 76070 252998 233313 193397 409811 198437 123971 437408 384849 252813 203671 149156 174857 372939 125304 223737 359168 135243 125290 191729 336869 154749 172553 182685 185908 320897 103939 379486 185049 449638 218224 370998 ...
output:
3262
result:
ok single line: '3262'
Test #72:
score: 0
Accepted
time: 5ms
memory: 3520kb
input:
5000 5000 3000 345603 259347 457252 53819 21084 290117 58042 155808 35221 262298 255695 87320 86214 277750 314848 493910 29232 24620 141999 58599 209510 62132 428154 398665 218644 427584 427000 203865 345102 497781 152466 2818 496007 46813 193977 362476 474879 231614 47580 118808 406704 221935 26896...
output:
4892
result:
ok single line: '4892'
Test #73:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5000 5000 1000 442643 427786 115434 461305 80383 40531 131588 39034 259498 99929 346614 119292 46660 71404 362622 185796 142817 372606 198483 93416 154946 20853 50041 101856 46020 211968 197158 204796 52899 247111 406425 493579 116301 288805 256154 385813 101025 121262 240152 114899 297232 460505 44...
output:
2819
result:
ok single line: '2819'
Test #74:
score: 0
Accepted
time: 5ms
memory: 3724kb
input:
5000 5000 2000 444150 20471 426640 390713 281513 447409 295072 309630 3298 458954 33506 421467 391406 445418 214648 53172 448182 440021 241876 246585 300405 80478 495572 223314 496209 169199 438585 251353 99328 396702 165649 258387 394363 156683 301578 57379 116742 349474 178727 283252 242478 490233...
output:
3666
result:
ok single line: '3666'
Test #75:
score: 0
Accepted
time: 8ms
memory: 3724kb
input:
5000 5000 500 432819 107379 142855 326489 17141 410725 47197 119046 73545 418690 372840 37295 109784 331667 396671 126782 368583 393593 241781 136834 32871 128213 267429 138256 341249 6057 185040 373492 491384 159018 285915 157535 477709 115894 296454 83515 483338 49049 482745 478473 443300 404174 4...
output:
2489
result:
ok single line: '2489'
Test #76:
score: 0
Accepted
time: 1ms
memory: 3800kb
input:
5000 5000 200 228321 30903 283036 106041 171768 177274 256174 480737 71764 263200 240066 290343 317293 401084 481077 427747 485905 32571 231779 473871 38150 171828 495391 269523 357796 340502 54610 109334 94982 179478 55928 220969 53695 398338 456601 230913 64534 492164 383683 219561 401637 155109 2...
output:
2302
result:
ok single line: '2302'
Test #77:
score: 0
Accepted
time: 4ms
memory: 3876kb
input:
5000 1000 50 48441 41704 477114 383744 499841 200066 317311 397327 84585 244935 236734 104344 325103 147395 427042 152228 57166 445283 256824 309977 151298 184234 105132 366367 312845 333831 480067 329547 454006 315229 236937 426775 364416 76740 397299 143610 293176 289967 83533 116807 328416 293617...
output:
1452
result:
ok single line: '1452'
Test #78:
score: 0
Accepted
time: 4ms
memory: 3652kb
input:
5000 1000 100 482472 335777 394636 283454 307167 452257 280035 385798 442563 455894 450220 222541 33203 15682 101338 329363 122000 320015 103025 238649 99755 3868 260466 365008 459268 120599 242967 297169 165232 476290 101278 398884 2113 348711 410570 121439 450875 373479 73800 339034 498149 319947 ...
output:
1858
result:
ok single line: '1858'
Test #79:
score: 0
Accepted
time: 5ms
memory: 3868kb
input:
5000 1000 200 403161 338757 448219 208597 208256 999 359255 409236 281589 77161 23148 352536 409588 483181 295996 40411 120785 399304 480327 148154 302588 325036 209995 77476 262801 435634 272109 30846 94551 314694 279256 179762 365249 467227 416219 390 219808 373606 374868 358642 224112 447977 3578...
output:
2268
result:
ok single line: '2268'
Test #80:
score: 0
Accepted
time: 5ms
memory: 3632kb
input:
5000 1000 500 261816 481505 355382 67053 228893 433167 485782 316650 464504 482876 345218 155387 12315 123151 485150 17621 10341 459867 297453 445821 207743 57013 36636 163101 102197 334304 4494 340400 398200 20661 330333 427105 205971 21397 29673 198985 314835 155789 454786 447706 454132 229138 383...
output:
3660
result:
ok single line: '3660'
Test #81:
score: 0
Accepted
time: 4ms
memory: 3640kb
input:
5000 300 10 294665 118144 421853 399204 312876 366838 84346 38809 458425 400342 195244 484831 92473 389916 50444 487526 362399 167434 133031 489104 110474 250797 404071 457015 68622 24931 420803 485018 113768 247958 137554 262237 192851 288069 258211 42237 243632 249875 353797 146837 236294 16097 28...
output:
493
result:
ok single line: '493'
Test #82:
score: 0
Accepted
time: 4ms
memory: 3648kb
input:
5000 300 50 194542 418742 398973 274394 436628 183193 207945 400346 484911 146893 45436 9628 52698 370228 403979 6744 124079 219366 328822 241580 390780 332044 235544 126899 82521 119188 464162 26966 261084 98904 74406 310686 255533 370429 42354 170684 189331 449235 190915 23777 492038 43699 396413 ...
output:
1512
result:
ok single line: '1512'
Test #83:
score: 0
Accepted
time: 4ms
memory: 3724kb
input:
5000 300 100 363815 437558 255450 19995 139399 35894 39263 320866 330490 250984 351308 102569 396072 112227 6061 292484 115138 324461 73776 156379 250128 413191 190071 145623 155189 308556 133671 395091 421214 240636 466101 202179 366353 324254 221564 2733 58305 467662 362735 156688 448709 261763 29...
output:
2230
result:
ok single line: '2230'
Test #84:
score: 0
Accepted
time: 5ms
memory: 3688kb
input:
5000 300 200 238606 165016 72841 286686 8386 118411 366292 16012 152503 161892 243400 39811 327668 97130 7927 60401 190901 342860 282248 496540 362061 219721 200445 61353 452878 415961 373290 190884 341138 427939 74135 366946 20555 220334 185912 185679 326135 71876 66070 23812 301898 45265 359219 63...
output:
3931
result:
ok single line: '3931'
Test #85:
score: 0
Accepted
time: 4ms
memory: 3520kb
input:
5000 30 10 280930 98742 431884 365998 439105 304477 102241 227771 28235 149835 464808 407100 317570 238691 121451 488661 71366 332291 426291 273277 24278 496952 15693 220181 102268 403763 16118 477669 415913 444854 7618 196232 148753 777 169279 77824 443475 20342 377976 317217 262849 187870 5504 309...
output:
1868
result:
ok single line: '1868'
Test #86:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
5000 30 5 160407 279646 331432 185106 355102 325428 293558 324852 216079 146997 12669 183500 162486 311554 260523 303460 368633 80102 121683 249175 2843 371363 241860 321049 400346 27200 488168 381436 499318 28035 366907 241325 30405 170616 165816 195159 422600 104562 345464 380497 254243 256812 317...
output:
1074
result:
ok single line: '1074'
Test #87:
score: 0
Accepted
time: 2ms
memory: 3744kb
input:
5000 30 11 361932 332532 215347 144818 184564 450781 294716 293728 181863 402085 75740 319651 386417 367496 225816 110532 427387 494469 285392 204094 233349 320938 327270 53990 423358 305799 476309 96648 454880 396901 119026 279486 367263 300551 64699 14716 326439 229019 98110 224362 62626 364860 77...
output:
1989
result:
ok single line: '1989'
Test #88:
score: 0
Accepted
time: 4ms
memory: 3748kb
input:
5000 30 20 348049 205305 256661 128117 33269 461586 69506 360251 493432 339745 39315 311878 126923 404212 256420 29430 237264 194990 395754 16212 273888 444814 65307 21980 272281 192918 454851 240200 132503 67876 54746 138727 465910 240792 369876 340085 116976 365607 472961 70647 254708 132168 26836...
output:
3466
result:
ok single line: '3466'
Test #89:
score: 0
Accepted
time: 4ms
memory: 3720kb
input:
5000 30 10 60861 203932 349891 343079 203932 203932 39455 305976 203932 203932 203932 78845 331948 203932 471742 203932 452213 41877 203932 36734 203932 203932 192246 203932 203932 483453 358204 203932 203932 203932 319708 203932 418251 203932 394612 203932 431550 151610 203932 203932 203932 203932 ...
output:
3237
result:
ok single line: '3237'
Test #90:
score: 0
Accepted
time: 4ms
memory: 3648kb
input:
5000 30 5 276513 276513 135364 390438 276513 103517 268491 276513 276513 276513 276513 450385 83539 276513 245047 276513 189465 142044 449426 276513 396789 276513 115220 276513 276513 431260 276513 10129 429227 276513 276513 276513 276513 276513 276513 63741 167820 51531 116415 311484 450662 350512 ...
output:
2854
result:
ok single line: '2854'
Test #91:
score: 0
Accepted
time: 4ms
memory: 3572kb
input:
5000 30 10 262922 405492 134120 51822 198135 340356 143122 53372 198135 23198 198135 121908 198135 283242 274443 198135 287836 193367 198135 9162 198135 98494 198135 359461 198135 86046 338206 176947 452115 230067 198135 494686 13216 274962 198135 469622 198135 198135 114441 207285 482186 88946 1981...
output:
3389
result:
ok single line: '3389'
Test #92:
score: 0
Accepted
time: 4ms
memory: 3524kb
input:
5000 30 20 106283 106283 106283 214001 474683 106283 143971 106283 106283 247912 106283 106283 106283 106283 106283 61749 372595 106283 162411 106283 157803 61420 106283 106283 336675 106283 106283 471371 98511 480833 460449 319128 106283 223224 106283 85710 437449 106283 106283 83382 141647 106283 ...
output:
4132
result:
ok single line: '4132'
Test #93:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
5000 30 23 308281 98366 250976 308281 424520 308281 24891 308281 308281 432053 214036 169052 308281 308281 308281 308281 451815 308281 481705 308281 308281 27241 308281 44376 309741 294985 308281 308281 47757 347741 308281 308281 308281 308281 310118 308281 181760 308281 7634 90863 472389 90075 3082...
output:
4451
result:
ok single line: '4451'
Test #94:
score: 0
Accepted
time: 3ms
memory: 3812kb
input:
5000 5 1 11845 14176 14242 12601 2182 3799 3769 11599 11467 14161 3595 1108 12823 2815 3193 5500 4867 4471 12673 5863 4156 940 7861 6319 316 2572 469 6862 13582 11839 13630 14767 5401 2542 13828 13267 3340 688 1168 1729 1804 11449 5557 3472 4279 14026 9226 14071 1003 1870 3424 1447 874 11995 10657 2...
output:
0
result:
ok single line: '0'
Test #95:
score: 0
Accepted
time: 3ms
memory: 3656kb
input:
5000 2 1 6268 10642 3004 13903 1456 12031 6952 6691 448 2938 14275 8656 7255 12361 5236 13975 5521 3634 2155 106 10918 9766 2548 12259 5239 1999 9220 2839 13516 9316 5125 487 4648 14800 3529 13228 2737 8878 1540 10309 274 1372 2269 3262 14608 14056 12454 13393 5779 12202 4339 13069 13492 1522 6409 1...
output:
0
result:
ok single line: '0'
Test #96:
score: 0
Accepted
time: 4ms
memory: 3852kb
input:
4998 5 1 1352 10627 10858 3312 121 2508 2858 6375 5329 810 4908 5349 8041 9816 1654 715 4111 2662 7061 5017 7422 3606 7926 2021 5552 1934 9823 7271 7134 5251 4408 9241 9339 9311 9721 11608 4117 7547 6168 9494 10834 8503 2039 7009 11125 11510 8972 6861 593 2206 9714 3200 2781 7128 10432 1184 9213 576...
output:
1666
result:
ok single line: '1666'
Test #97:
score: 0
Accepted
time: 3ms
memory: 3576kb
input:
5000 500000 1 1738 13663 13960 4258 157 3226 3676 8197 6853 1042 6310 6877 10339 12622 2128 919 5287 3424 9079 6451 9544 4636 10192 2599 7138 2488 12631 9349 9172 6751 5668 11881 12007 11971 12499 14926 5293 9703 7930 12208 13930 10933 2623 9013 14305 14800 11536 8821 763 2836 12490 4114 3577 9166 1...
output:
1
result:
ok single line: '1'
Test #98:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
3 2 1 1 2 3 3 4 5
output:
0
result:
ok single line: '0'
Test #99:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
5000 500000 499999 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 337225 3...
output:
5000
result:
ok single line: '5000'
Subtask #4:
score: 16
Accepted
Test #100:
score: 16
Accepted
time: 373ms
memory: 19404kb
input:
500000 500000 10 200184 74991 71203 334998 316800 34483 120570 301054 331108 232072 189788 397143 490296 56807 361700 88818 42376 460305 371750 450351 338384 429789 426045 445029 152316 408919 188124 144966 457495 475025 225370 260510 383159 495247 54319 246245 240728 372033 439599 119720 449020 451...
output:
312193
result:
ok single line: '312193'
Test #101:
score: 0
Accepted
time: 321ms
memory: 19432kb
input:
500000 500000 50 115284 354660 85605 451547 440275 269883 210494 181791 97169 97532 263985 106346 124476 164126 381493 219782 163879 157204 143832 387279 4369 170920 162107 286628 360679 297015 162335 375991 432661 437537 428657 490336 278522 452496 405280 362156 51892 437590 365597 224799 139341 44...
output:
315815
result:
ok single line: '315815'
Test #102:
score: 0
Accepted
time: 476ms
memory: 19580kb
input:
500000 500000 10 247245 32538 32538 32538 66100 116348 489150 32538 32538 337592 32538 32538 265870 127367 424999 32538 32538 249591 32538 32538 32538 2915 32538 312118 98677 32538 82852 246210 127902 102568 32538 474775 433925 32538 32538 477886 32538 240095 490687 152275 32538 177319 380963 150554...
output:
382878
result:
ok single line: '382878'
Test #103:
score: 0
Accepted
time: 358ms
memory: 19500kb
input:
500000 500000 50 74126 49011 367514 417555 184560 286059 74126 231718 83481 202258 411813 347616 60325 74126 74126 286009 74126 74126 74126 179065 110803 74126 184833 288128 388123 74126 74126 93751 130398 74126 125311 74126 254881 188001 108766 74126 216739 458816 352692 74126 343092 138882 121669 ...
output:
388605
result:
ok single line: '388605'
Test #104:
score: 0
Accepted
time: 323ms
memory: 19356kb
input:
500000 500000 100 86461 233990 79316 421287 65269 35378 441920 218216 326582 53709 231648 104859 251907 368631 12230 233266 458846 413320 464580 185043 36534 217436 235896 147447 323269 298618 272107 239801 331774 260283 14204 18336 403456 164055 47288 189349 140395 104161 111609 230062 249582 18306...
output:
316118
result:
ok single line: '316118'
Test #105:
score: 0
Accepted
time: 311ms
memory: 19496kb
input:
500000 500000 500 317156 322156 494965 421755 316506 344062 215650 117107 404655 136839 99599 377713 398553 358220 3168 402743 331586 264497 5706 379089 319033 346013 455742 120914 307683 114651 488018 436234 328984 474109 83330 455465 235972 356020 221510 470760 239610 314596 184357 30639 196228 16...
output:
316612
result:
ok single line: '316612'
Test #106:
score: 0
Accepted
time: 317ms
memory: 19500kb
input:
500000 500000 1000 287769 200264 467626 249411 177383 185151 480172 472198 209378 152588 419930 77161 80980 324085 95712 372613 227499 171437 59676 455301 150774 343341 143003 471079 422787 405738 378512 46559 347993 26033 55537 15554 423367 83975 146233 499539 219755 499441 305607 323634 314176 163...
output:
316382
result:
ok single line: '316382'
Test #107:
score: 0
Accepted
time: 318ms
memory: 19468kb
input:
500000 500000 5000 29097 482850 493172 169301 202467 153142 227539 394320 212453 126183 494312 434921 113472 294417 49068 50040 117099 35577 334975 24810 143735 216300 183819 305311 74834 101949 483930 27899 305218 95181 141808 124670 436794 54792 77370 480662 289415 253008 331927 110733 421843 2300...
output:
321548
result:
ok single line: '321548'
Test #108:
score: 0
Accepted
time: 317ms
memory: 19656kb
input:
500000 500000 10000 181264 414513 299591 90889 484478 330192 456670 390993 265407 367415 240702 403742 125367 315829 339749 439053 84378 309169 27097 148214 213586 449787 131495 228870 459800 455486 363137 20027 131681 308879 330763 313249 250746 420732 189828 40677 86404 395099 151933 478070 329019...
output:
325541
result:
ok single line: '325541'
Test #109:
score: 0
Accepted
time: 273ms
memory: 19356kb
input:
500000 500000 50000 332309 215491 215960 231981 78455 328186 70704 450637 445050 324766 469231 91236 366432 28231 159093 340824 216846 105069 491756 346856 478182 369766 42554 45643 359690 299854 383952 110806 467626 165014 60686 232543 361469 256884 330511 302173 338156 27982 233329 181220 377621 3...
output:
365957
result:
ok single line: '365957'
Test #110:
score: 0
Accepted
time: 310ms
memory: 19424kb
input:
500000 500000 100000 494950 127600 382303 13426 440066 313670 207504 377956 215847 41089 14988 203503 209583 390784 56974 249208 319129 162872 486515 21875 342186 401112 118041 118838 220152 6811 119207 161317 309896 345143 486716 188324 319757 216954 199101 338856 112356 467088 321624 496324 185106...
output:
415982
result:
ok single line: '415982'
Test #111:
score: 0
Accepted
time: 358ms
memory: 19656kb
input:
500000 500000 200000 310623 2810 238332 28613 463369 281030 7469 449506 174193 177392 156716 322737 391015 38888 286455 472642 429013 417969 490763 490099 490274 243206 41347 10345 417854 277217 379127 266984 260017 491775 77844 335498 298576 459547 136692 436035 387640 183348 40646 262252 406862 41...
output:
500000
result:
ok single line: '500000'
Test #112:
score: 0
Accepted
time: 330ms
memory: 19496kb
input:
500000 500000 300000 11225 190808 109993 401458 92547 132952 494060 263513 385433 280477 414936 284138 157418 315242 341687 252431 452366 20277 390392 414971 189064 428131 203564 131674 26532 375958 285893 94697 165841 351875 448584 155119 131702 33144 38647 396581 447202 82975 282346 195774 448569 ...
output:
500000
result:
ok single line: '500000'
Test #113:
score: 0
Accepted
time: 350ms
memory: 19528kb
input:
500000 500000 400000 470436 376573 347828 215247 435425 456031 58404 72719 149823 209332 9004 344149 384307 459271 435967 291247 415776 482325 158474 112139 270538 138174 304635 81801 445927 202151 7915 180375 221732 394754 194478 128096 241859 308102 340664 278172 378122 141634 224143 433525 141235...
output:
500000
result:
ok single line: '500000'
Test #114:
score: 0
Accepted
time: 338ms
memory: 19500kb
input:
500000 500000 450000 38822 317526 140637 371106 231927 353625 151795 28745 455224 49153 22557 434600 393316 461444 429937 243418 452907 136150 276080 283550 20050 278231 366379 305960 39457 82367 488114 322659 53930 257842 166760 457335 94121 87705 440161 496248 131993 480880 255499 206748 7205 1077...
output:
500000
result:
ok single line: '500000'
Test #115:
score: 0
Accepted
time: 54ms
memory: 7896kb
input:
150000 500000 1 101965 274429 382411 408673 22540 393958 380692 273187 215479 234127 10279 356944 407842 295888 204835 68215 88522 13834 322600 212533 423448 294187 416110 130477 277030 253909 351400 48691 274960 154741 130303 389785 26581 431410 304003 319360 333289 332197 403822 396286 122179 2840...
output:
0
result:
ok single line: '0'
Test #116:
score: 0
Accepted
time: 50ms
memory: 8168kb
input:
166666 500000 1 356284 48118 151504 339301 176992 402955 322582 90106 64657 34384 337750 415720 197266 92893 83437 49210 19789 17638 246796 293395 148900 22822 164209 199939 367267 377767 94936 306787 375247 6829 147109 397063 23059 98926 446119 205837 30706 426847 406960 459949 335188 195187 479740...
output:
1
result:
ok single line: '1'
Test #117:
score: 0
Accepted
time: 284ms
memory: 19352kb
input:
500000 500000 499999 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121...
output:
500000
result:
ok single line: '500000'
Subtask #5:
score: 29
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #4:
100%
Accepted
Test #118:
score: 29
Accepted
time: 376ms
memory: 19496kb
input:
500000 200000 100000 485016 197302 232201 104414 199148 21879 453003 21511 124969 488969 208302 372428 205126 399067 406946 151123 289256 380874 278556 411939 349334 431997 105101 276067 55839 18838 70786 371663 484315 359115 291070 179959 232257 104334 227537 303428 108482 259832 426545 379503 1932...
output:
499259
result:
ok single line: '499259'
Test #119:
score: 0
Accepted
time: 347ms
memory: 19500kb
input:
500000 200000 50000 261311 408509 126588 93280 331090 256978 234561 358951 10970 313415 111170 146054 339263 18935 397755 333172 217047 427953 368962 480847 362055 300581 478600 292054 362464 432024 310971 54857 213322 323701 395600 178365 406955 310369 5446 471922 486902 187268 188546 407021 435510...
output:
376015
result:
ok single line: '376015'
Test #120:
score: 0
Accepted
time: 351ms
memory: 19656kb
input:
500000 200000 5000 291258 266483 3810 55166 103005 167879 276292 432229 439014 456040 46059 273142 377033 404240 290889 322995 181634 219012 209326 24996 460403 163665 138022 360767 176954 105239 276366 377141 319423 123005 32955 248176 161294 459650 310926 429000 105 439797 227405 71090 351865 3492...
output:
288393
result:
ok single line: '288393'
Test #121:
score: 0
Accepted
time: 342ms
memory: 19356kb
input:
500000 200000 2000 277791 399817 395562 137348 368010 349355 176531 38192 246268 129632 125182 361783 444369 220072 230640 352324 198575 110935 73913 332705 418412 241598 330443 12626 63067 412430 497021 193234 206102 206849 63037 430521 323451 204281 455669 433432 82982 467747 173341 110710 320677 ...
output:
284083
result:
ok single line: '284083'
Test #122:
score: 0
Accepted
time: 351ms
memory: 19500kb
input:
500000 200000 8000 293068 423755 108948 387627 348728 201517 165408 347351 339873 262105 150181 219423 41441 174508 453606 493029 222846 254078 484517 92761 302233 218100 138953 475039 225001 61583 440672 66006 301210 367903 270253 182538 16656 315236 474337 474270 272557 163003 409016 331405 212936...
output:
293638
result:
ok single line: '293638'
Test #123:
score: 0
Accepted
time: 351ms
memory: 19640kb
input:
500000 200000 20000 179946 142572 5114 3370 463469 88065 72093 422971 363559 127246 181559 380815 413156 343780 381672 356894 253553 443652 377246 168529 28681 436537 98661 256355 303674 442555 307523 360094 121688 87412 378135 79781 74021 320818 26589 440557 309248 80028 159784 404240 62910 397509 ...
output:
314401
result:
ok single line: '314401'
Test #124:
score: 0
Accepted
time: 353ms
memory: 19412kb
input:
500000 200000 40000 488165 483784 267353 172322 91191 280316 490490 180969 119509 231235 345238 142864 223520 484972 452828 296285 8600 299356 487960 246725 250902 1734 106387 63062 174646 426684 369393 190494 330200 134975 340979 365292 167348 273200 250230 143001 51953 279653 14449 246024 403642 2...
output:
353834
result:
ok single line: '353834'
Test #125:
score: 0
Accepted
time: 392ms
memory: 19412kb
input:
500000 100000 50000 5803 477785 265670 477852 363869 186594 222287 398432 38271 15938 334023 289965 342813 390047 252400 246525 432587 61996 77922 55481 231210 11240 549 84556 427987 138265 7155 386686 262353 310693 374633 159289 386586 218501 5972 135923 566 51608 339601 49167 451096 296317 450814 ...
output:
498599
result:
ok single line: '498599'
Test #126:
score: 0
Accepted
time: 383ms
memory: 19424kb
input:
500000 100000 5000 495158 398746 94585 141699 245418 383428 273651 365286 125394 365858 401216 219144 98221 440155 202159 64048 298561 476887 369159 55700 113997 454829 223765 190312 179732 125234 315936 496200 250739 50863 374770 138606 232582 408344 180277 126657 368220 289050 227095 382062 491409...
output:
282184
result:
ok single line: '282184'
Test #127:
score: 0
Accepted
time: 371ms
memory: 19504kb
input:
500000 100000 2000 463143 9613 275502 214680 235089 77034 252552 120795 178155 157139 189057 428374 192106 433053 371617 174560 68679 209409 161887 337636 299546 4453 454184 76394 251564 451749 122018 312020 210736 269998 194325 219307 376001 427523 265064 102101 99802 337579 10245 214349 131917 357...
output:
270471
result:
ok single line: '270471'
Test #128:
score: 0
Accepted
time: 360ms
memory: 19648kb
input:
500000 100000 8000 219178 371206 269337 140068 363603 67873 438986 25917 349530 398790 130294 240488 77137 339402 419835 96573 155247 100944 98829 416348 413162 115435 194260 260311 464188 274332 289048 397688 342698 23398 195284 114158 238232 68493 86083 380995 437274 9166 89544 70321 26697 332545 ...
output:
294184
result:
ok single line: '294184'
Test #129:
score: 0
Accepted
time: 393ms
memory: 19416kb
input:
500000 100000 20000 154977 348029 48272 452404 367458 269060 158567 319330 214712 456627 109951 110089 312147 448094 479355 376156 262684 155777 429510 174777 328256 412919 33604 7096 283478 170158 149429 42136 440150 390849 165106 177308 338450 330570 227154 12284 257381 359683 329861 198857 334782...
output:
333885
result:
ok single line: '333885'
Test #130:
score: 0
Accepted
time: 424ms
memory: 19644kb
input:
500000 100000 40000 353009 351681 96890 424592 187130 231653 344277 24471 189647 459940 206817 456685 42775 181392 61002 444081 64582 32520 246193 231268 98399 179399 424226 253498 192598 419332 16620 474583 135673 134454 229993 469375 163694 315812 71701 321947 58172 374360 172035 285737 295602 132...
output:
432706
result:
ok single line: '432706'
Test #131:
score: 0
Accepted
time: 379ms
memory: 19504kb
input:
500000 50000 5000 30785 231321 69578 94851 362986 396786 137637 68577 100953 416634 355883 264642 428242 417144 41596 400354 20185 7377 333976 420148 258503 434435 469015 107941 136007 74091 184404 305648 289345 287157 226311 213822 201602 439160 350115 345391 354251 478952 148743 21762 327106 18589...
output:
286440
result:
ok single line: '286440'
Test #132:
score: 0
Accepted
time: 372ms
memory: 19508kb
input:
500000 50000 2000 94079 268077 492959 154832 179118 8882 498037 348507 480966 408261 240829 374970 309293 241662 335271 125403 421683 15088 127906 318143 340911 434807 437195 337949 145787 63498 319191 219234 6786 124551 496077 141135 364117 102054 22636 495280 375279 499208 198492 272354 25652 1082...
output:
270867
result:
ok single line: '270867'
Test #133:
score: 0
Accepted
time: 391ms
memory: 19524kb
input:
500000 50000 8000 132300 374450 391976 337463 496197 428486 437653 59777 267016 367640 206183 268597 81996 95493 435776 123386 311777 9051 193998 374415 148057 288912 90772 359740 29095 250244 489772 320489 172012 345201 243042 288644 196921 415011 407804 369905 52590 65855 376100 274865 153093 7270...
output:
307650
result:
ok single line: '307650'
Test #134:
score: 0
Accepted
time: 416ms
memory: 19528kb
input:
500000 50000 20000 294711 236967 416933 479848 289176 209689 441141 202542 63942 160197 29171 444563 324410 155830 417402 162001 453516 144221 111208 323545 81263 476043 465750 152897 49974 224342 54437 465495 480448 375198 481858 404308 178558 83200 142122 435330 381137 287911 118085 391377 455266 ...
output:
424593
result:
ok single line: '424593'
Test #135:
score: 0
Accepted
time: 354ms
memory: 19464kb
input:
500000 50000 40000 306698 428104 257954 311565 434144 218987 218797 236708 174430 224434 431719 329176 466739 289358 458198 493329 368946 407543 295097 462655 256573 386300 473252 26343 229058 483464 269895 470863 21116 174770 300810 39420 280770 379650 92919 470589 141517 373773 453275 385589 48502...
output:
500000
result:
ok single line: '500000'
Test #136:
score: 0
Accepted
time: 397ms
memory: 19432kb
input:
500000 20000 5000 430163 66017 184670 452277 346237 453834 380070 130295 142285 451124 498201 242772 396383 121584 355162 298096 475840 205988 91969 165140 482069 153026 474665 436533 68930 63792 67281 334884 251676 310764 256274 284533 38774 114469 207435 282508 462141 242344 71692 246637 285931 24...
output:
337255
result:
ok single line: '337255'
Test #137:
score: 0
Accepted
time: 404ms
memory: 19524kb
input:
500000 20000 2000 8344 334654 300193 396365 200539 477149 6214 271778 168029 146954 417858 238055 61366 321767 45886 299833 323375 198781 371170 407543 241327 317330 496540 348898 224957 319344 211655 231965 86196 119269 380022 338193 138482 433251 412399 191548 299457 108716 425766 412111 209313 39...
output:
281853
result:
ok single line: '281853'
Test #138:
score: 0
Accepted
time: 411ms
memory: 19660kb
input:
500000 20000 8000 22286 181704 111203 294727 2253 376240 435632 361726 311304 426637 141670 80586 25553 325999 75537 258519 10196 343898 232020 450382 47837 194346 167756 441124 262776 142461 484693 488545 154798 95846 168539 232041 167717 16861 167204 215839 270688 68099 104593 461036 110288 27057 ...
output:
418933
result:
ok single line: '418933'
Test #139:
score: 0
Accepted
time: 391ms
memory: 19432kb
input:
500000 20000 1000 29464 393886 329992 242638 18776 231566 241117 181173 407859 117268 435312 430652 159117 57084 246292 486775 437070 345653 57689 69323 34588 239566 384544 331638 413222 173543 25419 344477 464060 175306 51505 48895 49899 181681 271304 297220 250109 16932 175118 142794 107250 105055...
output:
266640
result:
ok single line: '266640'
Test #140:
score: 0
Accepted
time: 366ms
memory: 19424kb
input:
500000 20000 5100 149013 309299 424636 301581 357283 191842 170849 206217 169176 223512 236752 429908 194442 328785 411176 448035 307674 400906 124160 54923 494194 25273 95692 302690 474289 371541 489575 376772 71558 256513 382769 127793 225451 28926 304924 310235 66196 160766 180390 244469 22589 35...
output:
338956
result:
ok single line: '338956'
Test #141:
score: 0
Accepted
time: 288ms
memory: 19468kb
input:
500000 500000 3000 420676 123784 344137 9426 86832 6255 91678 389667 493742 441570 24188 124840 492713 57089 327231 144372 342148 420463 369727 550 316602 123466 418001 475370 66119 42610 318055 473731 205659 125854 434476 341785 493900 51940 388067 81761 50854 257001 62572 20009 64329 116423 23191 ...
output:
319214
result:
ok single line: '319214'
Test #142:
score: 0
Accepted
time: 335ms
memory: 19528kb
input:
500000 500000 1000 287769 200264 467626 249411 177383 185151 480172 472198 209378 152588 419930 77161 80980 324085 95712 372613 227499 171437 59676 455301 150774 343341 143003 471079 422787 405738 378512 46559 347993 26033 55537 15554 423367 83975 146233 499539 219755 499441 305607 323634 314176 163...
output:
316382
result:
ok single line: '316382'
Test #143:
score: 0
Accepted
time: 321ms
memory: 19588kb
input:
500000 500000 2000 26881 114047 84514 211721 259608 479377 473112 495343 36035 298942 300826 272077 378392 30019 392890 136956 135266 346050 475902 367435 220293 400930 484517 111437 382253 485951 95561 258079 122403 152644 477385 460242 276405 83738 307081 107479 498601 19345 496467 306055 275665 3...
output:
317802
result:
ok single line: '317802'
Test #144:
score: 0
Accepted
time: 312ms
memory: 19508kb
input:
500000 500000 500 317156 322156 494965 421755 316506 344062 215650 117107 404655 136839 99599 377713 398553 358220 3168 402743 331586 264497 5706 379089 319033 346013 455742 120914 307683 114651 488018 436234 328984 474109 83330 455465 235972 356020 221510 470760 239610 314596 184357 30639 196228 16...
output:
316612
result:
ok single line: '316612'
Test #145:
score: 0
Accepted
time: 309ms
memory: 19652kb
input:
500000 500000 200 60756 427592 340298 81486 28024 377891 382951 448780 133855 238012 295691 70348 362059 410071 284681 236837 245548 495343 238399 308352 434180 15226 132287 469754 461891 323344 311593 94117 203509 295483 5633 275787 366316 194203 23635 429312 481351 197459 419568 232919 163144 3819...
output:
316041
result:
ok single line: '316041'
Test #146:
score: 0
Accepted
time: 375ms
memory: 19532kb
input:
500000 1000 50 282887 228013 331155 236484 165007 124357 281535 399476 32023 252160 95670 443853 194539 206117 460839 353307 286487 77379 208853 116471 51663 273149 58909 461793 22505 438986 440807 170663 364461 174174 326081 284416 61832 284353 14148 307588 96960 75205 102048 116884 143670 495637 4...
output:
259670
result:
ok single line: '259670'
Test #147:
score: 0
Accepted
time: 354ms
memory: 19428kb
input:
500000 1000 100 91923 348738 464838 122371 314634 448450 2128 348189 124639 287138 226349 251582 281357 7196 191059 15177 128628 486498 382504 99472 296659 435118 101077 486276 121185 417200 273650 35875 3534 447866 121189 184809 230610 122761 87203 27432 85418 257528 127566 233236 281585 441970 245...
output:
274788
result:
ok single line: '274788'
Test #148:
score: 0
Accepted
time: 369ms
memory: 19424kb
input:
500000 1000 200 160591 12105 254465 278219 232617 527 454000 419935 235045 304046 111907 158770 289537 129539 224441 184328 422784 336873 202181 358668 257803 48891 283616 154181 359032 412896 488021 80457 9685 207370 403144 458485 221717 486476 343686 58080 72889 435476 355310 24588 95094 95796 400...
output:
308688
result:
ok single line: '308688'
Test #149:
score: 0
Accepted
time: 407ms
memory: 19552kb
input:
500000 1000 500 163453 242311 325049 124593 444421 338674 97307 471889 63283 112323 174796 152166 323670 296491 96845 436676 246187 178239 178477 493237 486524 427110 57550 22911 145185 472106 416110 358057 475072 180992 191676 145735 203420 70533 95318 29315 469443 189883 315009 165437 92583 470254...
output:
483967
result:
ok single line: '483967'
Test #150:
score: 0
Accepted
time: 357ms
memory: 19660kb
input:
500000 300 10 170596 487500 222716 303877 188113 116294 104678 98434 108187 51407 13213 364580 212184 477480 361555 493087 167435 405760 77606 460281 438384 120347 316303 118978 44536 395923 387014 404757 317422 282245 352290 130026 420232 181589 299396 330723 176893 448752 498648 107093 317160 4272...
output:
250712
result:
ok single line: '250712'
Test #151:
score: 0
Accepted
time: 370ms
memory: 19416kb
input:
500000 300 50 224075 29742 397731 30226 434538 94670 40330 70128 301037 154900 109495 205112 419691 335276 106449 99232 413313 481928 474745 173890 212365 101915 461844 280095 335419 379349 311776 481182 269147 378883 478872 419077 244938 398585 7330 201258 354435 241117 153569 201984 152070 86776 2...
output:
291291
result:
ok single line: '291291'
Test #152:
score: 0
Accepted
time: 388ms
memory: 19644kb
input:
500000 300 100 437241 323267 35857 406793 194152 144569 357979 79617 66174 396297 284633 31787 311922 3383 71386 473122 320656 302336 437794 410433 244992 123616 281702 31872 348981 36491 368227 409294 449002 87877 300485 332642 139606 397097 399704 390045 87011 482656 284114 301891 143096 379058 25...
output:
363399
result:
ok single line: '363399'
Test #153:
score: 0
Accepted
time: 347ms
memory: 19588kb
input:
500000 300 200 50194 73632 295000 460097 301694 267997 183839 153021 29300 320679 464403 307425 104495 74965 111880 414324 62473 453236 378169 335349 470277 474998 140199 65340 493807 331624 126517 191019 88995 247857 253316 273569 89701 355995 361789 309123 46686 476219 27766 449473 314723 51597 29...
output:
500000
result:
ok single line: '500000'
Test #154:
score: 0
Accepted
time: 359ms
memory: 19372kb
input:
500000 30 10 99796 333980 75796 208150 220856 145804 235007 279563 434997 472588 57509 105875 106183 374095 311768 19409 207091 59798 24 196577 11261 27136 635 492459 420005 66405 359241 120530 165076 498289 97656 180540 229526 246541 456083 449330 323271 43969 11769 74101 200864 62106 75141 57909 7...
output:
330169
result:
ok single line: '330169'
Test #155:
score: 0
Accepted
time: 325ms
memory: 19520kb
input:
500000 30 5 46778 413951 228705 230959 47433 199137 362368 182185 67184 392556 386229 498924 23006 95189 390563 285879 132819 175974 469734 320935 21893 87645 43093 473838 53172 82824 203179 185161 96366 36603 398300 264479 256140 491621 281824 101307 310069 188822 294016 218928 480412 457375 343928...
output:
263620
result:
ok single line: '263620'
Test #156:
score: 0
Accepted
time: 372ms
memory: 19440kb
input:
500000 30 11 156859 445724 436526 145521 127720 285219 223993 357948 48029 229136 218778 150567 266719 99420 22998 315452 223236 150673 350898 246692 209076 376945 327180 165987 7173 25567 333632 327432 216376 108691 125563 221398 349883 473179 136364 41042 452257 253450 336069 392759 136522 118373 ...
output:
345551
result:
ok single line: '345551'
Test #157:
score: 0
Accepted
time: 403ms
memory: 19528kb
input:
500000 30 20 174302 121411 349552 451426 165929 57102 128878 50675 35619 367316 484238 163887 339603 309819 144393 345405 464943 467943 193535 320881 459936 190515 386415 352423 456884 343084 120223 474885 294178 345960 351372 372025 65218 6391 415149 60176 139146 264505 175965 478628 365133 62443 3...
output:
493308
result:
ok single line: '493308'
Test #158:
score: 0
Accepted
time: 374ms
memory: 19468kb
input:
500000 30 10 288535 267557 267557 407449 96685 267557 484909 332849 267557 99193 2952 21797 267557 131072 267557 54058 267557 295752 384341 146831 267557 267557 167639 267557 267557 442213 267557 292114 459784 449686 373562 395577 21563 43420 441754 387464 3569 284272 275331 171743 267557 267557 267...
output:
396649
result:
ok single line: '396649'
Test #159:
score: 0
Accepted
time: 359ms
memory: 19408kb
input:
500000 30 5 449839 449839 449839 413457 267042 16205 436600 449839 105235 449839 491566 416022 63447 295856 3588 461507 449839 452490 108433 449839 449839 271418 449839 340678 449839 449839 449839 239304 449839 382413 448655 449839 114778 449839 449839 163507 51678 360166 449839 449839 449839 40405 ...
output:
362866
result:
ok single line: '362866'
Test #160:
score: 0
Accepted
time: 367ms
memory: 19396kb
input:
500000 30 10 364766 466867 171288 466867 490309 200071 283936 412514 464475 292227 466867 241079 319435 466867 466867 266457 57519 110274 466867 466867 466867 42297 421744 466867 466867 466867 462893 301156 466867 466867 13335 154651 466867 344761 442770 110653 466867 466867 418694 423111 373959 466...
output:
399909
result:
ok single line: '399909'
Test #161:
score: 0
Accepted
time: 405ms
memory: 19416kb
input:
500000 30 20 391858 381543 79338 79338 363747 79338 79338 112880 376546 390898 446819 69944 376435 79338 79338 79338 79338 79338 365315 90182 79338 79338 79338 246004 79338 449675 79338 268995 79338 79338 79338 224198 440168 258832 79338 249457 9678 219701 313371 79338 79338 79338 79338 310175 27687...
output:
488011
result:
ok single line: '488011'
Test #162:
score: 0
Accepted
time: 411ms
memory: 19412kb
input:
500000 30 23 75099 24185 304988 350487 24185 82243 383477 126408 24185 282845 24185 40871 24185 24185 24185 24185 24185 216153 110358 327139 24185 466856 24185 378887 314202 24185 24185 361016 352274 24185 217094 249554 24185 238866 24185 24185 24185 164235 24185 218406 24185 24185 24185 21186 19792...
output:
497653
result:
ok single line: '497653'
Test #163:
score: 0
Accepted
time: 364ms
memory: 19472kb
input:
500000 10 5 281694 240605 419237 108359 186080 274871 483281 221444 172541 423201 278858 241338 34158 187389 343493 13340 8413 300175 135108 451644 317401 340325 418862 409531 91130 395832 281325 446461 236060 188885 448467 127824 363485 186734 195971 185646 306806 258920 405775 291647 390815 485056...
output:
388212
result:
ok single line: '388212'
Test #164:
score: 0
Accepted
time: 401ms
memory: 19468kb
input:
500000 10 8 373106 326835 467969 277854 414146 145645 358091 289660 348551 84334 427772 423139 320438 405256 78927 376975 85540 415995 445239 203491 137075 280882 380177 46396 25916 410445 39999 26514 238430 222523 380940 464742 298553 291697 188389 328173 88835 380442 95700 285054 82356 130475 3230...
output:
493981
result:
ok single line: '493981'
Test #165:
score: 0
Accepted
time: 325ms
memory: 19520kb
input:
500000 10 2 275131 453634 368050 92676 200682 355666 130350 34579 300859 33807 54822 409366 128646 371364 173152 412873 301425 315529 250606 154534 317351 290676 331573 111642 465081 402857 468554 180843 290870 473000 199496 21932 441493 184702 174292 127874 391791 205710 427829 144542 340527 68779 ...
output:
252825
result:
ok single line: '252825'
Test #166:
score: 0
Accepted
time: 331ms
memory: 19356kb
input:
500000 3 1 85686 326854 119248 405269 104211 155268 102363 30412 147865 189353 359261 494045 278262 30817 155152 301893 196356 79242 382911 81359 238154 229391 261197 194244 153261 353731 427844 276199 2886 479601 434831 160178 476875 356073 87688 310893 278383 103266 427675 35359 1929 253426 36635 ...
output:
296489
result:
ok single line: '296489'
Test #167:
score: 0
Accepted
time: 329ms
memory: 19256kb
input:
500000 5 1 377554 198104 196604 277042 243975 62200 215139 115984 161124 178071 407212 194907 97977 202831 147676 253366 106588 220375 226822 369913 216104 235753 17578 323211 411681 414077 294822 238607 442881 404232 111793 212742 44682 367482 213013 10554 29339 211415 111084 317923 213798 410719 5...
output:
243230
result:
ok single line: '243230'
Test #168:
score: 0
Accepted
time: 327ms
memory: 19376kb
input:
500000 9 2 14789 300772 290046 71938 365996 65635 426856 16441 366585 184362 380753 55251 310050 148217 284193 246679 47941 308986 439563 408647 302339 288162 458954 148577 358253 404390 172298 135456 409221 431193 475470 157514 432578 400654 276730 34047 222763 488964 445871 350867 156156 196120 10...
output:
258638
result:
ok single line: '258638'
Test #169:
score: 0
Accepted
time: 382ms
memory: 19364kb
input:
500000 10 5 96183 258499 52816 258499 305553 258499 258499 137754 258499 237142 317874 280220 258499 106000 258499 186462 11468 258499 258499 488764 171547 451599 258499 448901 435127 380631 49285 258499 384250 102441 57184 258499 258499 182356 258499 286894 125754 181188 258499 258499 258499 161295...
output:
418506
result:
ok single line: '418506'
Test #170:
score: 0
Accepted
time: 438ms
memory: 19424kb
input:
500000 10 8 342876 11597 110834 7300 132280 326634 145757 186747 59811 102000 132280 291832 132280 227366 132280 252888 132280 114496 132280 222553 132280 367792 320676 498672 338344 132280 132280 132280 132280 132280 49445 132280 132280 123067 132280 479321 448690 342892 132280 132280 60071 338869 ...
output:
489613
result:
ok single line: '489613'
Test #171:
score: 0
Accepted
time: 391ms
memory: 19432kb
input:
500000 10 2 312678 312678 324677 312678 18022 312678 312678 222818 340895 312678 402383 312678 200591 14417 312678 77936 470255 174043 312678 312678 382119 312678 312678 415486 363582 312678 57465 312678 312678 335909 312678 223131 386989 312678 312678 312678 322667 426240 312678 311739 442027 29571...
output:
342888
result:
ok single line: '342888'
Test #172:
score: 0
Accepted
time: 358ms
memory: 19256kb
input:
500000 3 1 144447 181433 481611 181433 61073 493228 153628 18083 8402 190424 181433 366464 181433 181433 40130 462097 439426 181433 85331 151244 181433 304821 181433 181433 181433 411092 179551 181433 498268 287804 12108 181433 139405 197546 402485 409377 181433 181433 181433 301943 137394 253888 50...
output:
372816
result:
ok single line: '372816'
Test #173:
score: 0
Accepted
time: 336ms
memory: 19528kb
input:
500000 5 1 227421 250331 455564 203779 243840 133729 133729 133729 162756 133729 499923 149142 133729 133729 133729 350815 64068 133729 100891 17771 247140 205802 464568 19536 133729 342638 390432 290125 100753 112411 118863 351895 42180 133729 133729 468924 133729 133729 85927 133729 133729 133729 ...
output:
339023
result:
ok single line: '339023'
Test #174:
score: 0
Accepted
time: 350ms
memory: 19416kb
input:
500000 9 2 484613 484613 246916 43000 471510 484613 82285 498409 310364 64424 381636 178250 356538 27765 484613 382259 472024 447534 484613 486168 241446 484613 487422 51354 484613 484613 484613 48816 163666 456536 484613 484613 318442 484613 107381 484613 484613 246092 484613 484613 361154 100982 2...
output:
346231
result:
ok single line: '346231'
Test #175:
score: 0
Accepted
time: 49ms
memory: 7812kb
input:
150000 5 1 384907 290995 401422 175618 188143 160042 295720 436057 356533 238657 41611 179476 362104 57793 112057 421135 135370 44806 42094 222262 88645 13174 219517 413083 368584 165259 429949 270742 253723 396172 192784 317389 270859 281740 6535 324223 399604 98212 5446 397114 374182 440332 291727...
output:
0
result:
ok single line: '0'
Test #176:
score: 0
Accepted
time: 36ms
memory: 7816kb
input:
150000 2 1 421804 256897 174799 268012 355537 344269 117130 240583 425995 55981 344032 447808 94681 160762 410863 225841 342439 417826 392245 382996 101455 101212 41536 6688 365665 297877 392506 84922 3220 5254 435700 191980 287944 61609 432130 286618 351679 300760 305353 319144 245248 395473 46741 ...
output:
0
result:
ok single line: '0'
Test #177:
score: 0
Accepted
time: 56ms
memory: 9336kb
input:
150000 5 1 6554 269645 19546 109947 155650 272812 90512 3820 15524 157732 64409 65633 248319 50797 35572 26318 104102 74758 307386 181235 116223 334364 228639 339796 39548 264776 182618 156571 95933 205710 333310 93774 11383 54556 202151 124230 265396 10907 8408 135654 105596 269491 270790 105205 52...
output:
50000
result:
ok single line: '50000'
Test #178:
score: 0
Accepted
time: 45ms
memory: 8040kb
input:
150000 500000 1 8428 346687 25132 141361 200122 350758 116374 4912 19960 202798 82813 84385 319267 65311 45736 33838 133846 96118 395212 233017 149431 429898 293965 436882 50848 340426 234796 201307 123343 264484 428542 120568 14635 70144 259909 159724 341224 14023 10810 174412 135766 346489 348160 ...
output:
1
result:
ok single line: '1'
Test #179:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
3 2 1 1 2 3 3 4 5
output:
0
result:
ok single line: '0'
Test #180:
score: 0
Accepted
time: 289ms
memory: 19380kb
input:
500000 500000 499999 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121 101121...
output:
500000
result:
ok single line: '500000'