QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#790625#3872. Gym Badgesniumachaoren100 ✓76ms28104kbC++14924b2024-11-28 14:10:122024-11-28 14:10:13

Judging History

This is the latest submission verdict.

  • [2024-11-28 14:10:13]
  • Judged
  • Verdict: 100
  • Time: 76ms
  • Memory: 28104kb
  • [2024-11-28 14:10:12]
  • Submitted

answer

#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
inline void read(int &x){
	x=0;char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch)){
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
}
const int maxn=1e6+10;
using namespace std;
struct node{
	int l,x;
	bool operator<(node b){
		return x+l<b.x+b.l;
	}
}a[maxn];
int n,p[maxn];
priority_queue<pii>q;
//bool vis[maxn];	
signed main(){
	read(n);
	for(int i=1;i<=n;i++){
		p[i]=i;
		read(a[i].x);
	}
	for(int i=1;i<=n;i++){
		read(a[i].l);
	}
	sort(a+1,a+1+n);
	int sum=0;
	for(int i=1;i<=n;i++){
		int x=a[i].x,l=a[i].l;
		if(sum<=l){
			sum+=x;
			q.push(make_pair(x,i));
		}
		else {
			if(x<q.top().first){
				sum+=(x-q.top().first);
				q.pop();
				q.push(make_pair(x,i));
			}
//			else {
//				q2.push(make_pair(x,i));
//			}
		}
	}
	int ans=q.size();
	cout<<ans;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 5656kb

input:

8
539270098 632706230 269629236 114860227 516388668 106926736 442326081 489479590
349109371 304195858 1 1 1 1 1 272176035

output:

2

result:

ok single line: '2'

Test #2:

score: 15
Accepted
time: 1ms
memory: 5644kb

input:

8
709047428 992101994 911394172 790816372 955920979 601260981 382158825 576258298
1 1 1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

score: 15
Accepted
time: 1ms
memory: 5644kb

input:

10
410225545 331027005 171655992 23993846 574501736 812513369 560289640 118944002 140595187 271274589
101761486 138941857 1 1 386041033 124577204 10463923 1 171169400 349156480

output:

3

result:

ok single line: '3'

Test #4:

score: 15
Accepted
time: 1ms
memory: 5732kb

input:

10
536897107 501305556 788210776 663372540 52135338 652045195 406681332 17197090 503608396 436757332
42258645 188386343 54514746 103557391 1 53439943 1 1 235340362 407283951

output:

2

result:

ok single line: '2'

Test #5:

score: 15
Accepted
time: 1ms
memory: 5548kb

input:

10
329812627 580947084 875802829 648324811 287296765 747107865 765657366 563755052 498953661 684776526
1 1 113144166 1 503793060 183144317 99738328 1 1 271526219

output:

2

result:

ok single line: '2'

Test #6:

score: 15
Accepted
time: 1ms
memory: 5592kb

input:

10
322161776 554303213 421740595 270520769 292452403 434399611 384639892 116730549 114181770 607745841
1 198389486 1 223831462 1 65167091 1 862668690 498505120 268278795

output:

3

result:

ok single line: '3'

Test #7:

score: 15
Accepted
time: 1ms
memory: 5660kb

input:

9
299075145 581580990 10268 298645450 316639453 445559321 438713303 155454790 238247173
6103 161145018 523141 9933 3079 9760 280695703 3842 585375893

output:

3

result:

ok single line: '3'

Test #8:

score: 15
Accepted
time: 1ms
memory: 5608kb

input:

10
199149756 11986933 23690204 318151367 403432267 718745502 285161430 372719141 276300797 360593562
23503789 568223837 32202385 117719364 328393737 30037066 111973850 167956939 180364075 62469560

output:

4

result:

ok single line: '4'

Test #9:

score: 15
Accepted
time: 1ms
memory: 5584kb

input:

8
392336863 244685480 22558824 477462819 165844525 445936229 440232935 293644327
20390669 389158546 18704616 223892226 11708326 497527846 196738031 9601624

output:

3

result:

ok single line: '3'

Test #10:

score: 15
Accepted
time: 1ms
memory: 5580kb

input:

8
573920917 167422499 56738986 547977673 534455960 234649455 52881005 382019973
284059182 647555082 1 217998532 311443056 324326076 66107253 19220143

output:

4

result:

ok single line: '4'

Test #11:

score: 15
Accepted
time: 1ms
memory: 5736kb

input:

8
15151126 106185099 172755854 202723947 6156538 156713723 107329574 171461595
280860381 579486399 92903806 125554405 47346996 422012256 410734007 363810222

output:

6

result:

ok single line: '6'

Test #12:

score: 15
Accepted
time: 1ms
memory: 5648kb

input:

8
147335012 131541216 21030789 211944052 288410807 91730271 184285678 79860226
355583073 187666531 345541612 757269673 129593514 874125663 167115599 283291058

output:

6

result:

ok single line: '6'

Test #13:

score: 15
Accepted
time: 1ms
memory: 5716kb

input:

10
356214936 65576298 79315204 43324142 83332351 82351290 227964918 82051461 167637503 485448056
53785502 95275339 829926889 512973526 383840426 61358642 279319248 1 553790484 329577870

output:

7

result:

ok single line: '7'

Test #14:

score: 15
Accepted
time: 1ms
memory: 5648kb

input:

10
260507814 473776627 79015408 347161886 114333653 70539045 463901015 80346290 186454404 354937703
80040910 206974051 259764518 294311896 79547688 42996205 254940966 266452673 158194151 376405578

output:

5

result:

ok single line: '5'

Test #15:

score: 15
Accepted
time: 1ms
memory: 5584kb

input:

10
880911 464764212 485453246 414521280 129402979 329098106 417939920 237613475 74132651 312951770
4100849 225713676 161336617 322934480 458621 21549124 132990039 187973866 186105260 567814304

output:

4

result:

ok single line: '4'

Test #16:

score: 15
Accepted
time: 1ms
memory: 5544kb

input:

9
12070871 10006982 5860483 16847225 151599310 163322476 93697644 20787509 803016035
35881543 25202977 96509517 20126028 274768732 736792117 105202677 82002577 22602202

output:

8

result:

ok single line: '8'

Test #17:

score: 15
Accepted
time: 1ms
memory: 5740kb

input:

9
55222025 50303738 104487660 486807329 103598083 267664048 54294812 17920985 272891044
236535001 94554606 140573622 92510684 728512878 451015429 880759870 365910029 637470494

output:

8

result:

ok single line: '8'

Test #18:

score: 15
Accepted
time: 1ms
memory: 5652kb

input:

8
1499926 16387303 217806057 63129699 524104156 89822546 30076876 498442284
17443344 486784333 718910978 699599527 110616867 344238377 521374887 141726834

output:

7

result:

ok single line: '7'

Test #19:

score: 15
Accepted
time: 1ms
memory: 5608kb

input:

10
68857466 157581500 55958697 199035028 32000066 73775967 4311729 41623493 318344470 43083665
930188086 431298452 92918237 238993351 615951784 297617755 654096078 203887738 635681822 562644609

output:

10

result:

ok single line: '10'

Test #20:

score: 15
Accepted
time: 1ms
memory: 5660kb

input:

10
169413147 10251637 13590330 41462619 89944234 39539917 66772001 242726818 45347989 12747350
48787459 466771250 792235146 39574849 346430006 773238587 293815980 465969911 319445180 320703712

output:

10

result:

ok single line: '10'

Subtask #2:

score: 9
Accepted

Test #21:

score: 9
Accepted
time: 61ms
memory: 17876kb

input:

499024
24194059 58419582 93795671 46748573 538530 94101772 6557176 45861806 13697565 74131600 86230763 495874 93328371 85034659 58261516 3311420 83620814 92145308 62793177 67970802 63891191 62175600 59686038 44916927 32817940 23191454 40796822 55385422 97662235 82408332 33350127 65553532 70025555 47...

output:

1792

result:

ok single line: '1792'

Test #22:

score: 9
Accepted
time: 61ms
memory: 17480kb

input:

499046
94426972 18856284 64542583 61930781 29300775 96585573 76511591 62642337 70487218 72575097 68384 8226673 26676879 34380253 26677387 74692670 35914788 2175294 61456543 3976881 50687285 29547500 67867939 63687754 60356596 29604912 13846674 15347276 92319238 4137253 65823661 37636416 74833506 483...

output:

2589

result:

ok single line: '2589'

Test #23:

score: 9
Accepted
time: 54ms
memory: 18496kb

input:

499945
75086610 20430906 19432043 71361042 36665247 91270707 57153810 63125108 4170891 11274485 51914724 86096991 81622910 89756946 81666672 34687783 53295391 10237329 44484436 71565032 12593955 51284876 18960654 97115345 71028167 43172268 61003609 90748191 52980960 84026952 33719653 39455068 737089...

output:

2399

result:

ok single line: '2399'

Test #24:

score: 9
Accepted
time: 63ms
memory: 18600kb

input:

499181
81960960 93399006 57762044 68542540 40284787 41893029 82550813 81956582 80073846 38532595 38691803 40257359 71220582 15724567 81263354 11231790 91029524 89902053 86356229 19876341 79914712 59756687 46196282 33547977 8509584 62652621 18818233 86368449 15974151 37231717 70147170 4568700 1806191...

output:

2922

result:

ok single line: '2922'

Test #25:

score: 9
Accepted
time: 58ms
memory: 18728kb

input:

499975
54792433 53437075 50471711 61354519 62664352 88007726 71581615 42728389 46375545 31189677 72407210 51251012 54346926 84638513 95383571 26395242 41436731 78550437 88677233 88188763 32780907 37878541 48471392 43353618 37239437 74627658 68219343 88710946 98200793 79326876 84136158 98085079 89458...

output:

2638

result:

ok single line: '2638'

Test #26:

score: 9
Accepted
time: 60ms
memory: 19996kb

input:

499964
920146 295707 161191 1474 622334 782633 188798 678190 227363 68753 308280 790267 667361 755895 99095 304744 61896 227361 199289 888651 587856 12807 29960 344592 22601 609241 335654 397456 153427 298175 958697 787233 187799 145534 461063 896741 544381 418496 515252 791633 452029 892569 630103 ...

output:

21783

result:

ok single line: '21783'

Test #27:

score: 9
Accepted
time: 58ms
memory: 18300kb

input:

499953
684270 628507 799704 989598 684807 487942 778559 496672 813311 868169 784310 679989 537938 662819 333336 162463 284521 711361 436461 67465 39448 184679 96998 675976 297977 253234 396055 78633 690384 442011 253178 327129 643970 706345 979561 648490 829546 933761 317738 148528 495206 79348 5010...

output:

4525

result:

ok single line: '4525'

Test #28:

score: 9
Accepted
time: 64ms
memory: 19876kb

input:

499538
789959 386479 285010 800685 608461 548431 486060 517493 337155 863988 260006 161721 709092 844086 419659 141500 560059 290751 591435 186666 254722 435566 122531 538132 870784 399897 221045 107206 428062 828333 701144 174456 763540 604432 792770 842812 950853 506426 964855 714626 910704 676395...

output:

15882

result:

ok single line: '15882'

Test #29:

score: 9
Accepted
time: 64ms
memory: 17564kb

input:

499487
851435 422481 763100 221834 59699 97318 587331 535646 943483 490260 403784 339554 44189 648117 296828 656679 949633 334070 977567 816723 115378 317216 95560 623954 659141 414075 727905 409254 203289 853487 969543 435526 573039 94306 183793 489409 591838 414302 983422 655303 343739 444600 9562...

output:

21013

result:

ok single line: '21013'

Test #30:

score: 9
Accepted
time: 59ms
memory: 18604kb

input:

499667
779763 263882 889301 78862 191874 75041 559293 752584 699886 525310 193650 4782 177615 573872 130796 968366 879324 622344 459661 913140 659102 438897 419290 615726 338068 436782 479778 59880 702330 262202 153038 649570 791151 520928 736451 684152 712746 751712 784287 881048 916000 506681 5966...

output:

31312

result:

ok single line: '31312'

Test #31:

score: 9
Accepted
time: 66ms
memory: 24268kb

input:

499311
3530 4899 7266 3489 770 344 2390 4144 7703 7832 7524 1670 5797 8529 138 229 7486 9112 2101 579 8934 3824 3161 8715 34 1615 8747 8185 8584 4455 3036 9419 3510 5043 2267 9603 4995 1941 1662 2994 918 8155 8632 876 6806 3964 4043 2255 1678 5083 5091 6964 2777 67 7307 9968 463 9118 4834 498 5554 1...

output:

226514

result:

ok single line: '226514'

Test #32:

score: 9
Accepted
time: 55ms
memory: 26980kb

input:

499217
9270 7679 8890 7484 5663 1588 1399 9433 9324 1232 9525 7513 3417 4116 8539 8591 1965 5588 2378 2707 1370 1230 1814 6548 1779 1142 7932 9486 5044 1997 5992 9999 7774 2165 1811 5699 3151 7724 726 918 4366 9908 9838 2231 2833 8259 2654 1538 9098 7072 4055 9696 3672 8136 4534 4430 694 5305 9041 2...

output:

266396

result:

ok single line: '266396'

Test #33:

score: 9
Accepted
time: 57ms
memory: 24096kb

input:

499206
6985 2062 5131 3020 9967 5103 3082 1111 8933 4524 9107 8804 2572 7909 9577 7187 6900 2103 4075 9441 8823 9339 762 698 2875 2977 7151 5367 2345 744 8272 679 8629 1037 3397 7011 5318 2941 370 6104 3494 3894 7225 1635 9000 6121 3061 181 6017 2448 2276 8238 6963 8530 7138 3508 8425 6317 9230 919 ...

output:

253493

result:

ok single line: '253493'

Test #34:

score: 9
Accepted
time: 64ms
memory: 27616kb

input:

499885
7678 1612 8540 7526 8254 3985 9323 4811 4134 1902 225 2776 4625 6551 7065 9724 5886 9100 1004 8591 33 1694 3824 1135 8810 6209 5749 1795 4478 4661 6045 4834 132 8953 6542 3950 8158 6211 7187 1612 796 3861 8294 7003 187 2798 2703 6753 1346 5145 2003 2052 7325 6508 4728 8351 9979 1098 7704 6966...

output:

265350

result:

ok single line: '265350'

Test #35:

score: 9
Accepted
time: 59ms
memory: 27192kb

input:

499870
7308 6305 386 8322 585 9713 3517 964 1445 3940 9099 2875 3724 7003 9935 7461 5307 3950 5198 9136 4677 7607 1641 7913 626 9169 5746 6031 8161 3144 5352 4664 2216 3444 5790 7575 1250 4061 743 1040 9944 6065 7917 8686 154 4830 3498 6872 1649 8685 1317 6073 4267 5519 6847 7062 163 6759 686 7890 6...

output:

285611

result:

ok single line: '285611'

Test #36:

score: 9
Accepted
time: 64ms
memory: 20580kb

input:

499492
32959 74229 23123 6019 52931 48456 18170 24246 83648 32948 51393 58853 48263 17727 26205 22051 45485 80808 99750 21493 4856 54306 11830 49815 24219 96279 67580 50526 93352 2496 90400 6211 17108 84730 59170 84040 85249 78934 86472 97807 26024 35147 16108 91485 5380 81259 44556 75627 75382 9089...

output:

69991

result:

ok single line: '69991'

Test #37:

score: 9
Accepted
time: 61ms
memory: 20700kb

input:

499222
6868 12881 99208 48887 92460 17345 64864 79782 48124 20920 84660 22654 25947 74249 98061 52232 65691 39716 86804 20450 57865 41180 25102 11189 41931 73675 60177 67359 86092 58311 2972 61548 41217 65517 44681 57883 12037 21011 18098 90957 50579 90904 61838 84318 82951 29972 21362 21558 99085 1...

output:

85986

result:

ok single line: '85986'

Test #38:

score: 9
Accepted
time: 56ms
memory: 19020kb

input:

499926
51561 30101 33405 48688 96837 48828 2452 71232 77517 34300 98557 68518 69545 12953 62314 41200 93302 55884 44145 15609 32449 31379 38172 53552 23468 32748 66275 68932 67338 64776 31461 62720 11215 54677 948 87303 35095 57261 41552 31614 900 37354 87366 71594 13185 79481 66942 23964 63194 9710...

output:

95869

result:

ok single line: '95869'

Test #39:

score: 9
Accepted
time: 56ms
memory: 19216kb

input:

499662
47305 40581 31140 58197 8130 3290 19895 60150 59158 1974 10173 27369 34836 30988 95416 3535 6449 54751 95616 27147 81605 6201 797 30114 28369 47142 42258 36565 33431 41305 18461 96470 94835 47359 7909 219 1990 69067 17326 86548 85543 16446 42207 54188 71674 20055 8680 49742 11944 40200 36403 ...

output:

58194

result:

ok single line: '58194'

Test #40:

score: 9
Accepted
time: 51ms
memory: 17892kb

input:

499159
66146 60312 72358 47450 69778 10928 72008 75639 83006 13479 24004 325 33775 31922 48604 31969 17161 70368 960 23904 12630 89974 28346 39656 43015 26037 76666 76974 20428 76136 24123 15737 35279 93579 62950 78648 99305 32876 90594 12971 99507 45653 9304 156 60436 35255 90698 83192 47162 29191 ...

output:

33612

result:

ok single line: '33612'

Subtask #3:

score: 27
Accepted

Test #41:

score: 27
Accepted
time: 1ms
memory: 5684kb

input:

4920
343676952 471362068 183764630 14272498 286605010 453007536 667797750 174763306 161753738 692259390 402384334 207809675 24816038 135559720 2349171 268297289 158915976 311483232 237276350 130673100 523233652 177852180 84082840 350906472 27172979 107661274 8628817 205814954 636498502 115751626 451...

output:

200

result:

ok single line: '200'

Test #42:

score: 27
Accepted
time: 1ms
memory: 5656kb

input:

4959
31045087 85211705 386940468 44222643 513371244 70032107 162277716 389843506 351992229 769495655 94538714 128612441 20316461 340664105 217250441 136380179 600831379 205099111 31121955 22010105 233561290 15026090 10821194 305669116 155056392 36726080 374243838 46275540 71618529 864142250 18101853...

output:

203

result:

ok single line: '203'

Test #43:

score: 27
Accepted
time: 1ms
memory: 5784kb

input:

4940
191147592 561585528 26027424 194817274 504146004 300543149 389999817 6602202 172407240 207881509 9565348 456231471 265890013 70010351 37759586 471813616 831451004 125302588 3535044 339748403 451508095 334963999 773007442 809901641 309563430 14861043 245088753 249820242 429392886 192403949 48358...

output:

185

result:

ok single line: '185'

Test #44:

score: 27
Accepted
time: 1ms
memory: 5780kb

input:

4947
438114426 78173403 203639053 211071037 428778264 63687475 309300668 1062179 177454056 378053524 920264074 249997594 202258891 3224289 13527699 857341546 20115258 792574001 448840092 115667937 57305684 157386899 34290540 956451849 68552958 689520108 700803756 816849924 25084776 404702905 2422096...

output:

197

result:

ok single line: '197'

Test #45:

score: 27
Accepted
time: 0ms
memory: 5704kb

input:

4945
234768913 6725781 34645959 19269840 545922018 30552788 235626559 238178968 284069521 367595371 4965551 48658822 172986743 204934520 137257898 176236490 651641746 276816926 968111226 111556722 102668215 197348442 101977234 36416793 478905478 92287183 74681008 15046024 53469832 243005499 1675324 ...

output:

198

result:

ok single line: '198'

Test #46:

score: 27
Accepted
time: 1ms
memory: 5664kb

input:

4919
367009015 49139489 27332966 22465497 966734 323838 487594815 353082699 171655989 160662688 274743656 200929471 597922 72379961 102336390 541215116 526836 267383114 184397691 371907 20177077 313973309 521486708 15147280 69266730 204606 291370922 300206918 832635 14100989 804709 75761324 25748008...

output:

1045

result:

ok single line: '1045'

Test #47:

score: 27
Accepted
time: 1ms
memory: 5712kb

input:

4976
233328857 12858804 98607609 839390301 47490380 48569221 64815964 1232437 402274 77689493 166739 1456586 196708 217136162 569526264 592700 33573221 1120399 1946685 621118759 386754560 788242987 566562650 10456981 238524090 290658283 663047879 403297117 2249341 213545708 162703671 1412578 6900709...

output:

999

result:

ok single line: '999'

Test #48:

score: 27
Accepted
time: 1ms
memory: 5804kb

input:

4901
93473587 433773156 6571828 147489120 1621239 24243184 320271 19170255 709321745 481222110 66175985 40101934 270921740 381210023 722796034 195198 1009836 41680680 708546384 573591973 126560211 44470631 115581742 14404902 490070485 49238038 203521 2758507 373622 99420 156117178 102448604 5495232 ...

output:

1108

result:

ok single line: '1108'

Test #49:

score: 27
Accepted
time: 1ms
memory: 5740kb

input:

4950
34139185 360116 185804072 46913689 2290487 26079805 36533887 39784216 174011534 56708029 671872829 303670557 284529224 1711579 237298997 13064414 469377841 909883 226389063 140726968 226464188 666214739 698686285 650171061 218821198 134098 242833 408606784 402770691 1071855 65516083 69705933 30...

output:

1039

result:

ok single line: '1039'

Test #50:

score: 27
Accepted
time: 0ms
memory: 5732kb

input:

4993
1212662 44735284 315636239 40906 246446889 531284 180691894 47302946 40115791 11164706 126122707 1348013 594294460 1796339 164437892 1358237 573283427 49132071 90016445 14677074 242741369 180562508 5455032 488521690 548550112 247757 20136139 1189546 316205 6842077 321464685 358947463 21845209 1...

output:

1073

result:

ok single line: '1073'

Test #51:

score: 27
Accepted
time: 1ms
memory: 5776kb

input:

4985
758671 865319337 1227986 418306 34498557 38275541 592788521 333014 121636670 1683404 86872 123325 2945 73904882 532776341 1241799 38150622 316989 93275 196705 206645739 655954 22332698 98312 142152 58816 481179 113685 307227548 144243 682764850 266060 172325794 127131 506188 320794480 496276356...

output:

2019

result:

ok single line: '2019'

Test #52:

score: 27
Accepted
time: 1ms
memory: 5772kb

input:

4917
276899310 634897877 199838252 57816429 27892758 146734 291908 643854 440763 123502167 127626959 201712 646563234 334548374 96972 1109764 19917810 189296380 271598483 111865458 145352 314228 543146479 585922 215999291 70241193 90969 170215894 168510595 856224 231264936 205159225 184034 928499 25...

output:

2023

result:

ok single line: '2023'

Test #53:

score: 27
Accepted
time: 1ms
memory: 5744kb

input:

4953
187081446 328359 21131381 712500857 419534367 418777 328175146 89269538 43083504 1645802 335114445 143374 93639597 337872783 717011713 579965869 1142123 1136824 50240097 32032820 659213244 722301020 93640587 44900079 526479638 556811 747098902 228159157 7553166 536227532 334602 73954127 3772219...

output:

2008

result:

ok single line: '2008'

Test #54:

score: 27
Accepted
time: 1ms
memory: 5704kb

input:

4978
509378 518190 224533764 8334253 572237992 1576763 44509579 213525667 260668899 113132047 158171091 31274211 1417026 522456 99931020 530045 120360 93869057 806843 335300 57621830 13977653 84935148 160634 157176939 9593294 126051642 230390768 14155640 482087323 198981181 300408125 247719104 29606...

output:

2006

result:

ok single line: '2006'

Test #55:

score: 27
Accepted
time: 1ms
memory: 5808kb

input:

4967
364885182 596472 73981029 212766 119463 608768 132700 122933 405812 618666 145843655 458956702 241839083 8937088 789562678 185657 477472232 349812458 164688011 18568 195835 47673071 72406 786217494 178572383 108583 446695683 459963 172253042 673079504 1030793 47467476 131920 410859395 101441376...

output:

2054

result:

ok single line: '2054'

Test #56:

score: 27
Accepted
time: 1ms
memory: 5824kb

input:

4980
101666 34652960 117647711 35631508 20283157 97344 132828 155474 255421 511174 44377038 14495865 107162698 105153 219798095 588856137 251448 75860 520399 368 48833 452111681 184047962 428724 78403 39923 16374796 366027 49078101 637093 100461 104947548 375239 23220 481236 873971 331435501 7290451...

output:

3022

result:

ok single line: '3022'

Test #57:

score: 27
Accepted
time: 1ms
memory: 5796kb

input:

4929
66174076 50316 480155 29506640 322457 688283 87226056 525769 354098248 181997871 296042 480796759 282226568 107557 773 37183 215438727 859595295 250408 245836745 1219132 734533 128036 170663 109608 638453 175428 103134339 13375498 155414566 1728758 52787 228489418 834868 437419 58420 127114973 ...

output:

2965

result:

ok single line: '2965'

Test #58:

score: 27
Accepted
time: 1ms
memory: 5720kb

input:

4913
653641231 973042 10290 80206695 30163 4398 952241 35030 20143 137824004 694549 559680587 63017 66025 254343 19861 37847 116738 564795520 542312 105532 11869841 470117 20305 313980218 19276 893979405 962659 56189574 3872356 762392 46832 368159 177936017 218326 151894859 18339 79825 285734397 284...

output:

2964

result:

ok single line: '2964'

Test #59:

score: 27
Accepted
time: 1ms
memory: 5820kb

input:

4960
58239 176799 17950581 716906 352435692 31594515 299036744 177931430 487055756 106245180 809486552 81825 41840870 286747 8907609 25778 163525 133814 26254056 429436226 285689 85807950 247792759 545182 45227 271161 314563539 26335171 62437 28141949 168472 13210 135678903 43629408 631380943 748889...

output:

2967

result:

ok single line: '2967'

Test #60:

score: 27
Accepted
time: 1ms
memory: 5820kb

input:

4930
524657 870786 185114 115537614 658856 363620 269052 437872 111675 142059 353046 72028 78905 1390879 157411897 745 255001639 29219 288440858 53460476 151668 10805 191418 167729 993513 111051245 8306648 819110636 82725 266468 1077331 394562738 108397618 48922 431135923 131647889 450590124 194578 ...

output:

2960

result:

ok single line: '2960'

Test #61:

score: 27
Accepted
time: 0ms
memory: 5892kb

input:

4979
302810 156833 604544 468263 1407645 885525 67404 914695 88440267 181084 120207 100321 176961246 390786 24072 267832 280669 1714057 39329 248358 192994 76758 238469 30318 264017 286855 17570 119828 805801 185999 244950775 99827 75861 324567 17074 289888 1043469 26686 206546 37458010 229526 46129...

output:

4008

result:

ok single line: '4008'

Test #62:

score: 27
Accepted
time: 0ms
memory: 5764kb

input:

4929
134319 188468 187769778 291025 153929 36932 339889 289456 132694 23936380 233329 325890 184679 185829 97723 181997150 157662 164060 708343 97572 559041 163476251 32663 320343 392845 231172 18377 634859 293941298 82668 333687 74109 510343819 192485 249864 426247 47876 992204 560555 342323309 512...

output:

3961

result:

ok single line: '3961'

Test #63:

score: 27
Accepted
time: 0ms
memory: 5808kb

input:

4927
10228 46771 28231 258283413 368407487 273794218 271052 423567 225153 526229 524942 31025 807698621 80571 330176878 24425 64756926 86055 429602 107324 225087 419446 69730 362098 127360 52604 372506 161373 661900 192223889 17138 592026 168793 5141227 272244 176153059 592368736 156938 547079 37204...

output:

3973

result:

ok single line: '3973'

Test #64:

score: 27
Accepted
time: 1ms
memory: 5748kb

input:

4962
79263 203959 656814560 78632844 173447 203870 500440 500173 35956018 154468 69748 55613427 47826 275972 509690 10307 292701314 292301 128992 344954972 274896653 50013 246681 153080 236452 336234 472208273 288764 52258 146550 191537 248173446 367708 433921 184562 334014919 216342 298769 47098 64...

output:

3950

result:

ok single line: '3950'

Test #65:

score: 27
Accepted
time: 1ms
memory: 5812kb

input:

4941
161695 46299 305260 628291 80099817 217065 955289 6183 76915 78515 83869011 482761 501658114 355696 92354 60176 19895 169206 203344 133746 689396721 59036999 64142 33152716 73054589 596999 32969 511364 128721074 132544 249706 7513 497 216939 8824745 784535 144303 349942 210404 311623 231199 448...

output:

3990

result:

ok single line: '3990'

Test #66:

score: 27
Accepted
time: 0ms
memory: 5812kb

input:

4989
101953 191502 75696044 33567748 126963 50636 608893 161201 73186 612777 1341 422106455 215702519 918696 691740 28024 76112455 113653 415882680 158508 192833 204404 93275 396206 320006 327848 424035 170625 120636 122080 23403 117774 223700 814247 760960656 259490 12105 28749 23678189 701570942 1...

output:

4483

result:

ok single line: '4483'

Test #67:

score: 27
Accepted
time: 0ms
memory: 5896kb

input:

4948
72588414 768158 490646478 262619 8886 657119 879287 894378 120286 96259 106195 2558 207583 246263 137370 163943 22751 26572 111160 394945 146229 33417 55052 147764 357053 12327 22797 101956 16616 17438903 674342 83822 53264 114840402 34187 801531 12746 19129 596733 155021 255628 104269 36105 35...

output:

4472

result:

ok single line: '4472'

Test #68:

score: 27
Accepted
time: 1ms
memory: 5772kb

input:

4942
176791 493569526 431573 624154 166249 234961 192977 12955 461078 435090 16930 45401 271352 458215 222261 564507 98944 3377 247039 65746 20138 59941 62180 291054 435632 501714 674893 152437195 214583 656152 234547 479069 245343 75512 126822 65758 43164 289734519 64808 75824 31435 670391 11209 74...

output:

4667

result:

ok single line: '4667'

Test #69:

score: 27
Accepted
time: 1ms
memory: 5708kb

input:

4921
679266 315500 38551 61378 9837 134768 176963 125892 43463 210046 104343 386551 213532 133156 29918 257635 265193 98310 245289 371060 119609 449381 356969 119063 40018 425422 67170 42717 28713 232884 14960 23255 174286 59374 144991 814 14249 502971 10317 129167 249182 82809 69583 199152 43123 18...

output:

4666

result:

ok single line: '4666'

Test #70:

score: 27
Accepted
time: 1ms
memory: 5816kb

input:

4949
11129 82673 701279 130443 421274 488119 32461 237730 118676 120316 124173 57987 192292 263421 554951 29366 26559 1188730 590101 750101 271740 41880 194073 86153 189805 329738 75178 37303 302972 1050725 174517 54438 121612 905213 3529 361287 84580 70874 202347 46715 48136 14637 49471 63272 42323...

output:

4949

result:

ok single line: '4949'

Subtask #4:

score: 49
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #71:

score: 49
Accepted
time: 59ms
memory: 19732kb

input:

499978
20904968 28896247 38280150 66138600 38447241 1333810 38341167 5508812 38441515 129699921 22604681 28396083 77903740 199269984 96728832 139839610 157572095 22725036 15655401 94046700 28231691 22783123 16802478 75572354 182237909 124838630 41892682 54117937 74143404 11583600 14133888 8446622 79...

output:

5845

result:

ok single line: '5845'

Test #72:

score: 49
Accepted
time: 59ms
memory: 18008kb

input:

499912
68254452 33845883 49122872 59859531 39115313 79554841 127360501 132688977 35243860 52343852 63616395 68454786 35637237 63927341 172310876 73699305 4201233 80288040 3100800 32790094 99735684 59288589 142703639 74397782 1162474 28172472 72845932 79484446 66489289 143369447 70097343 88853908 629...

output:

5780

result:

ok single line: '5780'

Test #73:

score: 49
Accepted
time: 59ms
memory: 17544kb

input:

499967
149599459 13703738 126730428 127103318 63859127 65064379 114801606 96630095 39328961 197262662 148476005 124805884 81787129 7160939 58074652 66300625 31765839 11794868 680114 49684319 37632369 76965991 78959254 127573195 37029009 18989681 44127191 105228828 156747921 74942369 103849155 399934...

output:

5607

result:

ok single line: '5607'

Test #74:

score: 49
Accepted
time: 65ms
memory: 18528kb

input:

499915
65557878 18942888 28093294 78704584 84681961 48083343 50021674 47085062 86112029 27108079 10740276 48797545 9199240 86086277 56057515 79072826 1381894 101771117 87503882 105498159 23277215 7914800 260441039 25274912 182382789 89790367 63195776 117498542 46383646 161427018 236582264 13716055 1...

output:

5782

result:

ok single line: '5782'

Test #75:

score: 49
Accepted
time: 59ms
memory: 18240kb

input:

499979
42890025 69750214 7781140 76772383 75938925 50487263 897642 43095327 72890955 26269755 11177901 42806364 118987990 88680377 3830080 94311228 143826136 104018109 48230740 31545418 90005149 24397592 68501376 12205086 155700214 72101052 83337420 132626754 9437036 168575424 50107588 58327378 8774...

output:

5825

result:

ok single line: '5825'

Test #76:

score: 49
Accepted
time: 61ms
memory: 18936kb

input:

499923
2022 58978718 3219783 44408187 62979663 58144325 42708538 180746070 369693 52987255 81062118 37163 43742521 127782761 65624212 54138398 62593748 22661949 311935 65224708 21691954 9172 9600 31681124 72612756 30007 154190884 42975493 80489841 58670 23614687 18696 58419109 74005105 25666595 5004...

output:

75411

result:

ok single line: '75411'

Test #77:

score: 49
Accepted
time: 61ms
memory: 21240kb

input:

499946
157730233 104989103 1965 10029469 81670431 49896030 133955952 116634486 59517871 104516988 142209977 122283498 28851738 15774348 57806323 147485152 114441800 284498549 4082579 60815419 256571234 35245398 16658055 15022 3170115 55607484 10495078 35866969 117234251 44837798 62004774 2008 806041...

output:

75369

result:

ok single line: '75369'

Test #78:

score: 49
Accepted
time: 61ms
memory: 19660kb

input:

499972
23604943 86241533 27197125 33315524 95146858 110543156 79191598 62815816 171349653 148673940 8350549 12714948 5517103 22652761 92102938 60661342 41936781 126142082 58310969 117692439 15757338 43386417 256678069 14702543 117218851 34708900 60902348 58430747 2088463 93148885 48909754 18630 2542...

output:

75234

result:

ok single line: '75234'

Test #79:

score: 49
Accepted
time: 58ms
memory: 19956kb

input:

499991
44008368 8852830 1146 100866976 125289077 40019236 287118505 67 64099896 36795516 13307781 38335181 111695665 87348955 185925211 35119516 70573350 6848 57940526 4868 65767593 84664765 41971549 75693431 78415767 198807826 19251968 9919912 17172017 803 169213935 75126564 34474576 87863075 2184 ...

output:

74955

result:

ok single line: '74955'

Test #80:

score: 49
Accepted
time: 66ms
memory: 20500kb

input:

499962
68757144 9981627 158285360 59413005 74012978 231937764 315 96922787 53226529 23784532 7150 37528670 90152078 70909440 29415 3699232 208530951 14682667 41047299 275632832 56325277 1571 18533 14736 106621584 60407938 69473721 18838196 9251518 67527081 52884385 71616698 17616 98242500 75110091 4...

output:

74810

result:

ok single line: '74810'

Test #81:

score: 49
Accepted
time: 70ms
memory: 22484kb

input:

499963
4973 9706 30428995 42384001 3846 1738 3784 103319758 13312 31121743 2518 26053166 136072076 580 7644 3313390 904 42088290 112 36381820 2990 10102 25754814 14542 1922 8526 671 65445160 12438 49619871 36025495 5228 26230038 29008244 16829476 5200 109221032 127962894 106531510 155094406 36741257...

output:

199999

result:

ok single line: '199999'

Test #82:

score: 49
Accepted
time: 74ms
memory: 24200kb

input:

499951
63640354 9025 2084 3628 213812041 20285 105253319 29292783 1595 50 15797 51090227 78010644 21726490 66658076 62940490 36228139 970 15743569 9087 36150762 7977 20939207 6419895 240934 87019386 28482865 10790 86719090 65559054 140474585 2939 73693975 9795 90997442 5272 126 7326 6058 208 1371092...

output:

199051

result:

ok single line: '199051'

Test #83:

score: 49
Accepted
time: 69ms
memory: 22572kb

input:

499971
3116 1742 27526933 25677666 269 69444718 148038414 1422 173952380 37106900 55913616 136361683 562 4541 81 1433 61160280 150166452 1314 116289999 4217 22106859 4652 30675039 9027229 46227246 12039686 131590415 17436 38499721 30107677 342305185 3993 96462409 11701 67841721 110756490 62189809 12...

output:

199646

result:

ok single line: '199646'

Test #84:

score: 49
Accepted
time: 61ms
memory: 23576kb

input:

499914
3695 215784796 16897339 2558 1179 78593225 83091954 33568608 6089 140 1738 274686019 540 18539 11629616 78726206 2032 2703 1035 160826927 51353052 2573 99019 110531371 856 13094252 320 9407 4487492 18546054 12195 1927 6584 48147964 58394951 102093986 52566320 7936393 44429271 58822011 2013411...

output:

200026

result:

ok single line: '200026'

Test #85:

score: 49
Accepted
time: 59ms
memory: 23472kb

input:

499964
1573 13549314 111528637 53536586 22823682 105665960 8524 304 155525277 394 58374903 113108548 5203 8291 25781582 56274005 1875 2695 28884215 37506929 28552691 43088887 2562 186125918 15789 21252465 122338672 186585019 46148485 6071 11646 33309208 165601952 43325790 1009 29572170 1563 18133144...

output:

200372

result:

ok single line: '200372'

Test #86:

score: 49
Accepted
time: 76ms
memory: 28044kb

input:

499973
668 83225623 60768060 51090642 73688480 886 20912464 3365 2436 3082 30 2492 1251 3610 96262123 649 5361 6865 31740598 45973316 532 99109749 315 3806 887 451 2524 390 6379 2031 1491 29182942 236 2760 75272310 37053032 204 1613 685 81167616 99020684 4934 73355495 6967 1846 95032324 90693172 235...

output:

325069

result:

ok single line: '325069'

Test #87:

score: 49
Accepted
time: 63ms
memory: 27832kb

input:

499988
38196342 102466043 7917 1145 56247407 41981787 6098 1885 81289 201275222 58791306 221 8014 952 26562954 32292792 14215 1005 71471134 59850022 62 857 336 102967339 2781 3156 1149 310 1068 6723 62864682 12314238 310 59039211 34197132 4068 17508 141943084 7559 903 8066 33108505 655 996 4203 97 1...

output:

324814

result:

ok single line: '324814'

Test #88:

score: 49
Accepted
time: 76ms
memory: 26836kb

input:

499998
16896948 1567 195 4086 123592553 7720 2119 1608 566 130 24495984 1604 72616297 2831 3372 2272 2414 51129731 5776 2041 3829 252 17169055 82726952 62042894 113 70366375 5576 1707 1491 10830 7346 3222 1940 1778 1131 61890879 3659 9980 65105013 10759 90 172 1421 26570943 1003 3834 1391 23926197 2...

output:

324903

result:

ok single line: '324903'

Test #89:

score: 49
Accepted
time: 72ms
memory: 26596kb

input:

499979
63497607 236 2937 775 4694 111502442 23930898 1342 2596 3706 2507 6629916 141399529 57034643 60424683 3506 3839 73776781 3865 4222 65966970 198 472 311 31830178 2332 4975 1215 6418 4971 1059 7123 1800 752 150 9582 4647 2622 1547 5085 71590800 747 1697 150872314 8507 84071201 2038 3283128 4893...

output:

324905

result:

ok single line: '324905'

Test #90:

score: 49
Accepted
time: 60ms
memory: 27624kb

input:

499993
3328413 10626969 3415 1941309 4126 1017 51738817 130784724 31241190 11555 1008 8312 98286925 75434687 2960 5867565 4974 57709768 1192 92672407 573 3695 2209 83643808 2691 59926137 5279 2182 152290071 77449429 145945447 75540119 284 60702557 30 1361 398 94117250 2804 5103 13482402 11906904 464...

output:

325270

result:

ok single line: '325270'

Test #91:

score: 49
Accepted
time: 71ms
memory: 28000kb

input:

499936
6386444 30 2726 5749 70408435 4087 472 742 2443 1442 10181 95512487 3075 1683 2540 1925 3100 17243019 4190 3265 13167 4612 42000583 56 1500 8 6432 1784 433 115 6439845 447 1419 287 1477 38646082 457 1177 6166 800 1348 1112 5165 78756572 5342 1411 1745 2733 287 4068 1839 59135822 27830391 612 ...

output:

400387

result:

ok single line: '400387'

Test #92:

score: 49
Accepted
time: 68ms
memory: 25420kb

input:

499996
701 1282 2652 11286 981 51215622 495 59090836 607 38345452 1978 2796 198 1223 3089 2621 1968 264 941 5856 4921 2031 5060 103219741 4010 9271 4271 1391 3716 3451 43146819 2827 3647 30412147 556 4505 14129727 5629173 630 620 2766 10 30362362 3047 863 1692 15249997 308 5036 5093 2964 6418 541 66...

output:

400022

result:

ok single line: '400022'

Test #93:

score: 49
Accepted
time: 59ms
memory: 27332kb

input:

499906
1052 244728787 50442545 69690760 6426 404 271 2108 3183 8439 7781 256302764 6073 2703 691 15875547 704 1664 239 4226 4040 982 1105 45783121 14650209 846 1374 1901 22600022 3169 66503358 52256935 216983923 34714068 3326 920 3159 831 170 140 106121990 964 46179424 75340821 52712672 5257 1421 18...

output:

399766

result:

ok single line: '399766'

Test #94:

score: 49
Accepted
time: 75ms
memory: 28104kb

input:

499976
97542971 830 90876856 463 5232 5958 803 13883756 102994584 1126 1254 113 3828 369 16119115 194 772 5020 491 26527432 221221550 20942865 3974 1507 4166 674 900 532 1790 966 1808 1196 360 3397 922 1001 2177 1963 1425 1702 646 686 1112 72838870 3424 375 675 2611 2229 7413 1240 9 785 874 1754 169...

output:

399845

result:

ok single line: '399845'

Test #95:

score: 49
Accepted
time: 59ms
memory: 27504kb

input:

499996
995 1989 347 10927 1335 2110 477 2011 100052676 433 33057141 2657 5644 505 2569 64715202 96 111071329 1150 4883 7452 3713 367 593 4832 16955 6803 579 3503 1539 6115 41372015 3363 61854876 475 6341 920 6445 3994 2719 2061 786 3431 864 89 22754485 46528026 2200 2526 2015 103 4463 99853924 10484...

output:

400120

result:

ok single line: '400120'

Test #96:

score: 49
Accepted
time: 64ms
memory: 18968kb

input:

499936
65640173 45606186 3756398 76018220 66053740 42980624 9918831 25388621 34288709 127975672 54027674 159830153 11948539 74829486 7780406 86144964 48931370 47196138 1375354 49470809 170439 27425 30997486 5746173 68111850 48923389 35644342 99319232 116204570 21696 92392426 59681851 83109443 466373...

output:

20533

result:

ok single line: '20533'

Test #97:

score: 49
Accepted
time: 60ms
memory: 19100kb

input:

499953
83337810 47676225 3596015 72517913 7507272 25617613 67733412 109946918 196213716 71218025 77063453 129587943 9138118 56481843 45873287 33127105 324392019 67674799 45045136 162656953 122961861 62579829 89037668 22525351 83868634 53137591 64880998 153675141 32111089 18511845 108545686 40664741 ...

output:

20268

result:

ok single line: '20268'

Test #98:

score: 49
Accepted
time: 67ms
memory: 18404kb

input:

499988
49364712 202269760 220306824 41594844 92165 82987062 41150800 83712057 61204951 91363484 51452497 89465224 137849487 103876951 67892865 1206918 152172917 203445824 37263339 65090031 14633058 50890942 85315643 218405638 10571336 57498623 56421674 70420163 144944434 67179603 42386170 36677108 4...

output:

20461

result:

ok single line: '20461'

Test #99:

score: 49
Accepted
time: 66ms
memory: 25140kb

input:

499983
1043 2614 691 1720 4171 1538 2224 5418 147 1308 76 6864 563 1817 114 562 3162 2330 131 231 2160 2035 1936 251 2322 2046 1672 2287 3225 1694 452 1630 3168 106 4046 3664 1809 195 890 2042 1074 7586 727 683 7260 277 765 4649 2093 3257 314 58 5976 5828 2318 1142 336 1963 405 5096 5047 2004 3330 4...

output:

499983

result:

ok single line: '499983'

Test #100:

score: 49
Accepted
time: 61ms
memory: 26924kb

input:

499999
1641 6449 1649 1601 1194 14405 3047 274 532 3098 4185 5337 2992 2948 3991 68 4016 3844 2012 206 2501 1151 205 2651 1756 370 633 2685 248 2509 1512 2813 277 459 92 240 466 4837 1346 2080 150 603 150 183 2014 1211 639 322 3751 4890 3458 586 5477 266 36 274 169 677 362 1056 9210 3404 824 474 290...

output:

499999

result:

ok single line: '499999'

Extra Test:

score: 0
Extra Test Passed