QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#314023#836. Farm of MonstersAFewSunsAC ✓18ms14392kbC++141.8kb2024-01-25 11:21:472024-01-25 11:21:49

Judging History

你现在查看的是最新测评结果

  • [2024-01-25 11:21:49]
  • 评测
  • 测评结果:AC
  • 用时:18ms
  • 内存:14392kb
  • [2024-01-25 11:21:47]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace my_std{
	#define ll long long
	#define bl bool
	ll my_pow(ll a,ll b,ll mod){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res=(res*a)%mod;
			a=(a*a)%mod;
			b>>=1;
		}
		return res;
	}
	ll qpow(ll a,ll b){
		ll res=1;
		if(!b) return 1;
		while(b){
			if(b&1) res*=a;
			a*=a;
			b>>=1;
		}
		return res;
	}
	#define db double
	#define pf printf
	#define pc putchar
	#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
	#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
	#define go(u) for(ll i=head[u];i;i=e[i].nxt)
	#define enter pc('\n')
	#define space pc(' ')
	#define fir first
	#define sec second
	#define MP make_pair
	#define il inline
	#define inf 8e18
	#define random(x) rand()*rand()%(x)
	#define inv(a,mod) my_pow((a),(mod-2),(mod))
	il ll read(){
		ll sum=0,f=1;
		char ch=0;
		while(!isdigit(ch)){
			if(ch=='-') f=-1;
			ch=getchar();
		}
		while(isdigit(ch)){
			sum=sum*10+(ch^48);
			ch=getchar();
		}
		return sum*f;
	}
	il void write(ll x){
		if(x<0){
			x=-x;
			pc('-');
		}
		if(x>9) write(x/10);
		pc(x%10+'0');
	}
	il void writeln(ll x){
		write(x);
		enter;
	}
	il void writesp(ll x){
		write(x);
		space;
	}
}
using namespace my_std;
priority_queue<ll> q;
ll n,A,B,h[300030],a[300030],b[300030];
int main(){
	n=read();
	A=read();
	B=read();
	fr(i,1,n) h[i]=read();
	fr(i,1,n) a[i]=((h[i]-1)%B+1+A-1)/A;
	fr(i,1,n) b[i]=(h[i]+B-1)/B;
	ll sum=0,ans=0;
	fr(i,1,n){
		if((sum+b[i]-1-a[i])>=-1){
			sum+=b[i]-1-a[i];
			q.push(a[i]+1);
			ans++;
		}
		else if(!q.empty()){
			ll u=q.top();
			if((u+b[i]-1-a[i])>0){
				sum+=u+b[i]-1-a[i];
				q.pop();
				q.push(a[i]+1);
			}
			else sum+=b[i];
		}
		else sum+=b[i];
	}
	write(ans);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

3 1 1
1 1 1

output:

2

result:

ok answer is '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

3 1 1
2 2 2

output:

3

result:

ok answer is '3'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

10 34 100
17 27 73 17 60 12 25 53 31 46

output:

5

result:

ok answer is '5'

Test #4:

score: 0
Accepted
time: 16ms
memory: 14296kb

input:

300000 1 1
336470888 634074578 642802746 740396295 773386884 579721198 396628655 503722503 971207868 202647942 2087506 268792718 46761498 443917727 16843338 125908043 691952768 717268783 787375312 150414369 693319712 519096230 45277106 856168102 762263554 674936674 407246545 274667941 279198849 5272...

output:

300000

result:

ok answer is '300000'

Test #5:

score: 0
Accepted
time: 8ms
memory: 14252kb

input:

300000 1 2
75475634 804928248 476927808 284875072 503158867 627937890 322595515 786026685 645468307 669240390 939887597 588586447 973764525 521365644 710156469 985188306 860350786 11308832 784695957 770562147 208427221 35937909 67590963 726478310 475357775 255361535 135993561 166967811 46718075 8515...

output:

300000

result:

ok answer is '300000'

Test #6:

score: 0
Accepted
time: 17ms
memory: 14200kb

input:

300000 1 2
374288891 535590429 751244358 124321145 232930851 266089174 543529670 773363571 319728747 580543238 582720391 468188689 490702144 598813561 138628383 284660056 733781508 155605777 931759705 245485733 723534730 257812292 794937524 596788519 188451996 981010588 14483682 59267682 959461493 3...

output:

300000

result:

ok answer is '300000'

Test #7:

score: 0
Accepted
time: 10ms
memory: 14304kb

input:

300000 1 3
673102149 561219907 730593611 814024114 812959730 314305867 469496529 350635050 699021890 342102981 815487777 787982418 857896659 526518374 421876106 438907614 902179526 449645826 783856158 865633510 238642240 774653971 962475573 467098727 196513513 561435449 333165290 951567552 726980720...

output:

300000

result:

ok answer is '300000'

Test #8:

score: 0
Accepted
time: 14ms
memory: 14332kb

input:

300000 1 4
412106895 291882089 564718673 358502890 837699009 657489855 690430685 632939232 373282330 398630021 753287868 667584659 79866982 603966291 850348020 738379364 480642952 593942770 930919906 485781288 903492853 141752547 984789430 897217447 909607734 846893014 211655411 843867422 789467242 ...

output:

300000

result:

ok answer is '300000'

Test #9:

score: 0
Accepted
time: 14ms
memory: 14200kb

input:

300000 2 5
5887448 757703054 544067926 902981667 712695184 295641139 911364840 620276118 902318577 865222469 250896470 987378388 742028793 681414208 133595743 597659626 649040970 33207011 223207847 960704874 418600362 658594226 417168695 767527655 622701955 867509363 235369723 31134588 702210660 439...

output:

300000

result:

ok answer is '300000'

Test #10:

score: 0
Accepted
time: 4ms
memory: 14332kb

input:

300000 3 4
449924898 783332532 378192988 592684636 147499872 343857831 837331700 197547597 576579017 776525316 188696560 12204822 669031820 758862125 826908873 897131377 817438988 737312468 370271596 580852652 638740575 585501313 439482552 637837864 335796176 447934224 259084035 778210267 469729886 ...

output:

300000

result:

ok answer is '300000'

Test #11:

score: 0
Accepted
time: 12ms
memory: 14316kb

input:

300000 3 3
43705451 513994713 652509537 432130709 317463343 687041819 58265855 479851779 250839457 538085060 126496650 186774359 331193631 836310042 255380788 756411639 690869710 176576709 222368048 906033133 8623893 807375696 461796409 362923880 194114590 733391789 137574156 670510137 237249112 673...

output:

300000

result:

ok answer is '300000'

Test #12:

score: 0
Accepted
time: 18ms
memory: 14312kb

input:

300000 3 9
782710197 539624191 631858791 976609486 752268030 30225807 279200011 467188665 630132600 594612100 769329445 916633496 258196658 913757959 538628510 55883389 859267729 615840950 514655989 526180911 523731402 324217375 189142970 643299496 907208811 754008138 161288468 562810007 149992530 9...

output:

300000

result:

ok answer is '300000'

Test #13:

score: 0
Accepted
time: 12ms
memory: 14392kb

input:

300000 8 8
640274071 983359971 71550121 96204862 799843967 446173607 796619138 402690754 223219513 668171337 312183499 905549873 673542337 566661387 879397647 434495917 631413076 150918417 579868000 224422012 126195703 525305826 535526356 404334728 653535984 998133227 879226371 59632864 356493387 62...

output:

300000

result:

ok answer is '300000'

Test #14:

score: 0
Accepted
time: 7ms
memory: 14248kb

input:

300000 4 20
509061481 552472140 16115810 148658854 66743034 628305150 677780684 519361360 208050516 401554301 954478790 346543678 387546138 832279893 641889899 80960260 717802881 588066499 661699500 83254572 759454419 427833657 255743179 199661234 694729965 875591136 862937826 103626886 473906880 20...

output:

300000

result:

ok answer is '300000'

Test #15:

score: 0
Accepted
time: 14ms
memory: 14384kb

input:

300000 15 31
235040736 845224325 405102476 306020832 567954026 319923972 351391400 839247099 872095141 746927386 116079799 814749285 935104039 39200818 779623552 24872203 857355273 463838168 642352783 774850365 394389351 835930945 10847154 880608047 403727586 922549184 104520573 235608953 266338849 ...

output:

300000

result:

ok answer is '300000'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

1 1 1
1

output:

1

result:

ok answer is '1'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3540kb

input:

1 1 1
5

output:

1

result:

ok answer is '1'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

1 1 2
2

output:

0

result:

ok answer is '0'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3672kb

input:

1 2 1
2

output:

1

result:

ok answer is '1'

Test #20:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

1 7 9
3

output:

1

result:

ok answer is '1'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1 7 3
9

output:

1

result:

ok answer is '1'

Test #22:

score: 0
Accepted
time: 0ms
memory: 3668kb

input:

1 7 51
50

output:

0

result:

ok answer is '0'

Test #23:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

1 79 51
96

output:

1

result:

ok answer is '1'

Test #24:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

1 60 820
533

output:

0

result:

ok answer is '0'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3500kb

input:

1 664 188
495

output:

1

result:

ok answer is '1'

Test #26:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

1 297208 929600
614363

output:

0

result:

ok answer is '0'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1 589156 45728
619108

output:

1

result:

ok answer is '1'

Test #28:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

1 505899152 526332989
621636272

output:

1

result:

ok answer is '1'

Test #29:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

1 409449117 374415292
920449529

output:

1

result:

ok answer is '1'

Test #30:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

2 1 1
1 1

output:

1

result:

ok answer is '1'

Test #31:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

2 1 1
3 1

output:

2

result:

ok answer is '2'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

2 1 1
2 1

output:

2

result:

ok answer is '2'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 2 1
2 1

output:

2

result:

ok answer is '2'

Test #34:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

2 5 6
9 9

output:

2

result:

ok answer is '2'

Test #35:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

2 10 9
1 7

output:

1

result:

ok answer is '1'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

2 4 77
3 29

output:

1

result:

ok answer is '1'

Test #37:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

2 33 29
49 7

output:

2

result:

ok answer is '2'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

2 982 988
630 233

output:

1

result:

ok answer is '1'

Test #39:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 833 406
183 414

output:

2

result:

ok answer is '2'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

2 311557 743280
610538 535909

output:

1

result:

ok answer is '1'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

2 394981 292125
391092 198091

output:

2

result:

ok answer is '2'

Test #42:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

2 578786981 772798219
803767815 685001280

output:

1

result:

ok answer is '1'

Test #43:

score: 0
Accepted
time: 1ms
memory: 3604kb

input:

2 756870405 346347063
247805265 415663462

output:

2

result:

ok answer is '2'

Test #44:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10 1 1
1 1 1 1 1 1 1 1 1 1

output:

5

result:

ok answer is '5'

Test #45:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

10 1 1
4 5 2 5 3 5 3 2 1 2

output:

10

result:

ok answer is '10'

Test #46:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

10 1 2
2 2 2 1 1 2 1 1 1 2

output:

5

result:

ok answer is '5'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

10 1 1
1 2 1 2 2 2 1 2 1 1

output:

8

result:

ok answer is '8'

Test #48:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

10 8 10
9 5 4 8 8 10 8 1 6 2

output:

5

result:

ok answer is '5'

Test #49:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

10 10 10
7 9 8 3 3 10 7 3 3 10

output:

5

result:

ok answer is '5'

Test #50:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

10 34 100
17 27 73 17 60 12 25 53 31 46

output:

5

result:

ok answer is '5'

Test #51:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10 58 41
74 4 27 85 39 100 85 36 71 85

output:

9

result:

ok answer is '9'

Test #52:

score: 0
Accepted
time: 0ms
memory: 3604kb

input:

10 433 514
452 478 193 55 745 40 365 655 96 617

output:

7

result:

ok answer is '7'

Test #53:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

10 857 358
197 660 447 320 433 28 520 133 240 465

output:

8

result:

ok answer is '8'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

10 709678 848878
71446 771626 318378 706628 211084 370645 452763 725527 561797 990677

output:

6

result:

ok answer is '6'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

10 825806 397723
76191 433807 410736 152700 207259 554633 386918 29709 854941 517716

output:

8

result:

ok answer is '8'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

10 322022227 751269818
629795150 369443545 344607287 250044294 476897672 184054549 986884572 917181121 650451600 554222064

output:

5

result:

ok answer is '5'

Test #57:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

10 324818663 205138355
223575704 395073023 323956540 794523071 206669655 527238537 207818728 199485303 884520552 315781807

output:

10

result:

ok answer is '10'

Test #58:

score: 0
Accepted
time: 1ms
memory: 3668kb

input:

100 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

50

result:

ok answer is '50'

Test #59:

score: 0
Accepted
time: 1ms
memory: 3564kb

input:

100 1 1
3 3 5 3 2 1 1 4 1 3 4 2 2 4 1 1 4 3 4 5 3 4 1 3 5 2 5 4 4 1 5 4 2 4 4 3 1 2 3 4 2 5 3 4 5 4 3 5 4 4 3 2 4 5 3 4 3 3 5 2 5 3 4 2 1 1 3 1 2 2 3 4 4 3 4 4 5 5 1 5 1 3 4 4 4 4 4 5 1 1 3 2 5 3 1 3 4 3 5 3

output:

100

result:

ok answer is '100'

Test #60:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

100 1 1
2 1 2 1 1 2 2 1 2 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 2 1 2 2 2 1 2 2 1 2 2 2 1 2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 2 2 2 2 1 2 2 1 1 1 2 1 2 1 1 2 2 2 2 1 1 2 1 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 1 2 2 1 2

output:

73

result:

ok answer is '73'

Test #61:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

100 2 1
1 1 1 2 1 2 1 2 1 2 1 2 2 2 1 1 1 2 2 1 1 1 2 1 2 2 2 2 1 2 1 2 1 2 2 1 1 1 2 2 1 2 1 2 1 1 2 1 1 2 2 2 2 1 2 2 1 1 1 1 2 1 1 1 2 1 2 2 2 2 2 2 2 2 2 1 2 1 2 1 2 2 1 1 2 1 1 2 1 2 1 1 1 1 2 2 2 1 1 2

output:

76

result:

ok answer is '76'

Test #62:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

100 9 9
8 8 8 6 5 7 10 1 4 5 9 10 5 2 1 1 4 3 10 6 5 10 5 7 6 2 5 5 10 1 1 8 2 5 7 6 7 6 4 3 3 6 10 7 7 9 2 4 1 10 9 8 7 10 4 2 6 7 7 10 5 2 1 4 5 8 3 3 3 7 2 4 4 7 9 7 5 3 4 10 3 9 8 7 2 3 7 7 1 4 2 5 9 6 10 4 10 5 8 1

output:

56

result:

ok answer is '56'

Test #63:

score: 0
Accepted
time: 0ms
memory: 3664kb

input:

100 9 3
3 9 1 9 9 9 7 8 3 8 9 3 10 9 6 9 2 7 2 2 9 3 10 9 3 9 8 5 6 4 9 10 1 2 4 1 2 9 7 4 8 5 9 1 9 9 8 2 7 2 5 8 7 5 3 3 5 9 1 9 4 4 2 9 10 6 2 1 6 7 7 6 9 2 5 10 10 1 5 2 3 7 9 5 4 5 6 6 9 6 2 10 8 10 8 5 2 9 9 7

output:

100

result:

ok answer is '100'

Test #64:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

100 94 95
31 65 35 95 70 78 81 36 69 97 39 28 89 62 36 23 35 21 36 11 65 39 13 34 79 87 91 70 43 82 24 97 6 87 49 81 60 92 63 9 16 6 31 90 6 5 70 48 27 86 65 66 45 8 67 17 24 44 34 93 26 32 82 54 72 83 94 81 79 79 9 9 4 59 42 83 80 67 28 62 56 58 87 67 34 3 61 14 62 19 94 31 74 97 20 70 7 98 64 67

output:

52

result:

ok answer is '52'

Test #65:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

100 39 23
85 46 97 72 41 70 37 18 8 40 33 61 12 79 51 78 61 66 85 97 78 14 70 47 100 40 15 40 61 52 19 30 14 91 82 56 10 6 68 24 97 61 31 78 18 45 88 6 37 38 51 86 37 42 58 30 79 56 50 14 61 18 13 20 57 3 93 15 24 74 32 21 71 93 2 66 25 75 75 10 86 82 30 31 6 49 15 33 100 35 1 96 87 83 29 21 41 22 4...

output:

100

result:

ok answer is '100'

Test #66:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

100 81 122
18 561 601 538 804 877 55 943 955 751 206 881 249 227 640 846 6 935 544 383 628 688 609 898 25 669 837 272 848 595 599 376 280 855 953 122 779 687 751 29 97 18 666 571 123 11 223 527 88 26 901 493 923 371 947 411 378 228 423 816 497 219 439 228 573 183 156 144 426 610 11 849 310 893 682 1...

output:

100

result:

ok answer is '100'

Test #67:

score: 0
Accepted
time: 0ms
memory: 3624kb

input:

100 925 250
572 743 855 507 979 865 211 125 395 495 808 314 572 848 259 596 24 984 996 968 433 559 466 810 950 530 957 142 778 673 890 808 581 751 387 901 17 606 148 144 582 472 855 358 446 847 841 186 906 270 187 610 627 605 537 32 425 841 934 433 832 497 175 889 62 818 755 278 271 693 26 361 889 3...

output:

100

result:

ok answer is '100'

Test #68:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

100 312789 538116
666304 930504 856780 954598 358328 222020 393708 667786 445050 120840 580902 173462 493608 35452 521199 48788 969577 965294 392513 838387 137129 646732 85145 370116 693590 396843 843383 785981 973988 119108 949857 895866 425226 207409 650272 118647 147651 828852 848256 616535 12583...

output:

67

result:

ok answer is '67'

Test #69:

score: 0
Accepted
time: 0ms
memory: 3676kb

input:

100 363509 86961
479561 592686 981841 657567 130312 373304 327863 939264 738193 647879 348288 742999 655419 707561 993114 296346 400299 5342 456262 761972 244638 521115 399002 680324 787811 789000 590399 53148 717406 372482 35252 839298 227335 610521 452297 348722 767593 394771 321253 234649 291619 ...

output:

100

result:

ok answer is '100'

Test #70:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

100 348479310 617722226
734818338 418154900 301651637 10534985 81960960 525844408 908632707 334892077 367781717 862809937 829172860 579141787 414535294 293924102 726156087 237984260 314162669 471274418 416657569 523876428 28589735 284844258 431932024 182350667 125220039 228439898 711430865 202509136...

output:

62

result:

ok answer is '62'

Test #71:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

100 231595438 191271071
328598891 148817081 281000890 555013762 811732943 163995692 539632270 617196260 42042156 624369681 472005654 898935517 931472913 516596211 714436514 537456010 482560687 910538658 563721318 703832718 543697245 946910129 159278585 52660876 133281556 249056247 884888282 38977630...

output:

100

result:

ok answer is '100'

Test #72:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

1000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

500

result:

ok answer is '500'

Test #73:

score: 0
Accepted
time: 0ms
memory: 3692kb

input:

1000 1 1
5 5 3 1 4 3 1 4 3 1 3 3 5 2 4 5 3 2 2 1 2 3 3 1 4 5 5 3 1 1 5 1 1 3 5 2 1 3 2 4 3 5 3 3 3 2 2 3 1 5 2 1 2 1 1 2 1 5 2 2 4 5 5 4 5 4 1 3 2 2 3 1 3 3 2 5 3 5 1 2 2 5 4 3 2 5 5 4 2 4 3 2 5 5 3 5 3 4 1 4 3 5 5 2 5 1 5 4 2 3 1 4 5 3 2 4 2 3 1 1 2 4 5 1 5 3 4 1 3 4 2 1 1 5 5 4 4 2 3 5 5 2 1 1 5 4...

output:

1000

result:

ok answer is '1000'

Test #74:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000 1 1
2 1 1 1 1 1 2 2 2 1 2 2 2 2 1 2 1 2 1 1 1 2 2 1 1 2 1 2 1 2 2 1 1 2 1 2 2 1 2 2 2 2 2 2 1 2 1 1 1 1 2 2 2 2 2 1 1 1 2 1 2 2 2 1 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 2 2 1 2 1 1 2 2 1 1 1 1 2 2 2 2 2 1 2 1 1 2 2 2 1 1 2 2 2 2 1 1 2 1 2 2 1 1 1 2 1 1 2 2 1 2 2 2 2 1 1 2 1 1 2 1 1 1 1 2 1 1 1...

output:

747

result:

ok answer is '747'

Test #75:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

1000 2 1
2 1 2 2 2 1 1 2 1 1 2 1 1 1 2 2 1 1 1 1 1 1 1 2 2 1 1 1 1 2 1 1 2 2 1 1 1 2 1 2 1 1 1 2 2 2 1 1 1 2 1 1 2 1 2 2 2 1 2 2 2 2 1 1 1 1 2 2 2 2 2 1 2 1 1 2 1 1 1 1 2 2 2 2 2 1 1 1 1 2 1 2 2 1 1 1 2 1 1 2 2 1 1 1 1 1 1 1 1 2 2 1 2 2 2 1 2 1 1 2 1 1 1 2 1 2 2 1 2 1 1 1 1 2 1 2 2 1 1 1 2 1 1 1 2 1...

output:

746

result:

ok answer is '746'

Test #76:

score: 0
Accepted
time: 1ms
memory: 3576kb

input:

1000 5 10
4 10 10 5 7 7 2 4 5 6 8 3 1 8 9 2 8 9 4 9 1 3 9 5 9 8 2 3 6 3 9 7 5 8 4 2 8 10 3 7 6 3 7 6 2 3 10 9 2 3 5 6 10 7 7 5 2 4 2 3 3 5 10 7 6 3 9 5 7 8 5 3 2 4 1 3 9 4 6 4 3 1 2 10 5 10 5 8 5 2 8 3 9 1 3 7 8 10 6 1 5 7 3 7 9 5 9 8 7 7 8 10 8 9 7 7 3 8 7 3 4 3 8 1 10 8 2 4 10 5 9 9 3 6 2 3 8 7 2 ...

output:

498

result:

ok answer is '498'

Test #77:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

1000 8 7
8 7 7 7 5 1 1 6 9 9 8 6 10 9 1 10 6 2 7 5 10 6 8 3 10 9 8 3 6 2 8 9 10 8 10 7 2 4 6 10 2 9 4 9 3 3 4 6 6 7 8 10 10 5 9 6 3 6 9 6 3 7 1 8 10 6 8 9 2 10 4 1 2 10 7 8 2 10 9 1 1 7 5 6 7 3 4 1 3 7 9 4 8 6 1 5 10 4 7 7 6 4 8 3 8 8 4 3 10 2 10 9 6 2 3 8 1 6 2 9 8 7 4 5 5 10 6 2 2 1 8 6 9 2 2 10 8...

output:

673

result:

ok answer is '673'

Test #78:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1000 61 100
98 48 52 83 17 28 76 16 23 27 8 36 62 67 62 11 78 12 28 65 6 74 66 60 6 16 69 62 83 26 61 32 80 24 36 3 25 12 61 19 7 17 18 15 1 22 23 95 6 3 60 38 73 41 71 20 58 60 35 41 28 28 74 64 26 50 56 85 77 34 46 56 61 27 44 15 80 91 15 84 17 47 68 97 54 65 47 98 75 70 25 46 68 56 78 94 95 32 10...

output:

500

result:

ok answer is '500'

Test #79:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1000 20 5
47 29 5 55 100 12 31 98 75 75 98 65 81 88 76 70 100 57 81 51 12 53 23 81 23 81 82 36 1 100 48 68 93 32 66 74 63 31 54 34 88 71 7 91 17 62 37 54 27 51 54 66 73 71 61 37 5 77 39 54 67 6 5 30 15 73 55 19 34 20 57 68 36 58 100 98 25 99 69 36 43 71 3 69 14 15 96 20 8 86 36 15 89 46 94 53 37 44 ...

output:

1000

result:

ok answer is '1000'

Test #80:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

1000 520 999
552 931 480 348 671 930 534 80 510 4 176 583 686 73 81 239 523 968 447 468 517 286 523 285 929 366 764 533 310 580 524 635 33 153 49 146 57 58 54 250 115 705 207 229 111 266 776 787 273 191 143 342 257 157 38 663 995 53 586 135 360 540 78 479 884 435 825 808 438 295 523 380 810 658 700 ...

output:

497

result:

ok answer is '497'

Test #81:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

1000 944 844
514 113 733 613 358 918 393 558 949 748 971 16 9 990 996 989 541 208 899 350 323 670 84 493 446 227 180 403 536 554 919 67 333 457 483 925 590 465 346 172 896 159 204 312 922 510 394 957 91 139 236 163 153 688 821 284 850 369 993 752 695 626 110 844 372 263 424 134 282 378 539 83 686 88...

output:

573

result:

ok answer is '573'

Test #82:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

1000 88652 219391
118712 729500 600839 223140 849019 285308 150862 415920 156006 609740 168775 601066 367433 495436 753034 924779 179173 247247 334947 886625 333681 402366 984659 888845 35864 430931 950927 152325 108921 870750 759231 97203 97510 703428 811136 166676 565541 377658 66851 103545 22322 ...

output:

996

result:

ok answer is '996'

Test #83:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000 544044 172076
931969 615873 950092 701917 653706 469296 117722 976999 416446 202188 936162 203308 529244 943353 756 172338 609895 287296 622888 34403 408487 468237 298516 7565 130086 855792 665240 419491 628147 381021 877330 73339 932323 330732 613162 364046 152779 943577 315656 497468 188103 7...

output:

1000

result:

ok answer is '1000'

Test #84:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

1000 298882680 625881105
595389444 692470 424798881 288162168 461901905 63721259 180515960 847022240 526763419 325243078 960313706 835408525 476178687 151932619 610934120 208024163 364414050 779453603 355704679 368216046 498269419 430890650 590794721 171428891 604775299 246009952 95168851 377023357 ...

output:

647

result:

ok answer is '647'

Test #85:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

1000 476966104 199429949
189169997 321289244 404148134 832640944 336898080 111937951 401450115 424293718 201023858 381770117 603146500 155202254 698149010 374604728 744438738 507495913 532812068 73493652 353025324 843139632 868152736 652765034 613108578 746771803 612836817 971659005 118883163 269323...

output:

1000

result:

ok answer is '1000'

Test #86:

score: 0
Accepted
time: 6ms
memory: 12212kb

input:

300000 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

150000

result:

ok answer is '150000'

Test #87:

score: 0
Accepted
time: 0ms
memory: 14208kb

input:

300000 1 1
5 5 5 3 1 1 4 5 5 5 3 5 2 5 5 5 4 3 1 4 3 5 1 2 4 3 4 2 2 2 2 1 2 3 1 3 2 3 3 5 1 1 4 3 5 2 5 4 4 3 2 5 2 5 1 3 4 3 2 2 5 1 3 2 3 5 1 5 5 5 1 1 2 3 3 3 4 2 4 1 1 3 2 1 2 1 5 2 5 2 3 2 5 3 2 2 5 5 4 4 3 1 2 1 2 4 5 5 4 2 5 5 2 2 4 3 3 1 1 1 1 1 2 5 2 4 1 3 3 4 1 1 1 5 1 2 4 3 4 3 1 5 4 3 5...

output:

300000

result:

ok answer is '300000'

Test #88:

score: 0
Accepted
time: 3ms
memory: 12288kb

input:

300000 1 1
1 2 2 2 2 1 1 1 2 2 2 1 2 1 2 2 2 2 2 1 1 1 1 2 2 2 1 2 1 2 1 2 2 1 1 2 2 2 1 2 1 2 1 2 1 1 2 1 2 1 1 2 1 2 1 2 1 2 1 2 2 2 2 1 1 2 2 1 1 1 2 1 1 2 2 1 1 1 2 1 2 2 1 2 2 1 2 1 1 2 1 1 2 2 2 1 2 1 2 2 1 2 1 1 1 2 1 2 2 1 1 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 2 1 2 1 1 2 2 2 1 1 2 2 1 2 2 1 2 1...

output:

224941

result:

ok answer is '224941'

Test #89:

score: 0
Accepted
time: 7ms
memory: 12204kb

input:

300000 1 1
1 2 1 1 1 1 2 1 1 2 1 1 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 2 1 1 2 2 2 1 1 1 1 1 2 2 2 2 2 1 2 1 2 2 2 2 2 2 1 2 2 2 2 2 2 1 2 2 2 2 2 1 1 1 2 1 1 1 2 2 2 2 2 1 1 1 2 1 2 2 2 2 2 2 1 1 2 2 1 1 2 2 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 2 1 2 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 2 2 2 2 2 1 2 2 1 2 2 2 2...

output:

224992

result:

ok answer is '224992'

Test #90:

score: 0
Accepted
time: 15ms
memory: 11160kb

input:

300000 3 10
6 1 5 8 6 9 9 4 7 9 6 2 1 2 6 7 8 8 1 3 7 8 10 3 6 7 2 8 4 1 10 1 1 2 1 7 3 6 5 7 1 4 8 9 3 7 4 3 6 2 8 7 4 3 2 7 3 9 10 8 8 1 4 9 5 10 6 9 6 6 7 4 2 1 7 10 5 9 8 9 2 9 10 8 1 9 10 2 10 3 1 2 2 4 10 8 7 9 2 4 5 6 3 10 2 1 7 5 7 4 4 3 8 6 5 4 2 7 10 8 8 4 8 5 7 1 4 2 10 5 5 9 8 5 7 8 3 4 ...

output:

129911

result:

ok answer is '129911'

Test #91:

score: 0
Accepted
time: 3ms
memory: 14272kb

input:

300000 7 4
1 8 9 5 5 7 5 6 10 1 10 3 6 9 9 5 10 10 10 1 2 7 5 1 10 8 2 8 6 5 3 7 10 6 3 2 6 3 4 1 2 3 5 6 4 1 10 1 3 2 3 5 10 1 9 8 10 7 4 5 7 9 9 1 10 7 5 5 10 3 2 10 2 5 9 3 8 7 4 5 8 3 5 10 2 6 10 10 4 10 4 7 5 6 6 6 9 2 5 8 6 1 7 6 6 10 2 1 2 9 6 1 6 1 10 7 10 10 6 6 6 3 4 3 5 2 9 6 2 1 5 2 8 1 ...

output:

270052

result:

ok answer is '270052'

Test #92:

score: 0
Accepted
time: 7ms
memory: 14304kb

input:

300000 30 31
52 1 96 64 51 91 41 26 16 56 76 3 9 18 82 72 14 88 32 96 72 59 11 15 22 30 95 12 80 54 88 36 75 48 72 81 14 65 48 88 48 37 82 35 40 8 54 44 24 4 34 43 30 26 71 60 78 97 87 7 54 52 66 10 84 20 80 27 8 17 46 35 88 72 80 97 2 43 88 48 97 29 62 64 28 58 55 22 57 24 23 95 19 65 78 26 33 18 5...

output:

300000

result:

ok answer is '300000'

Test #93:

score: 0
Accepted
time: 4ms
memory: 12172kb

input:

300000 72 58
98 78 50 37 26 83 96 8 56 8 70 36 24 31 100 30 36 33 84 74 85 42 64 36 43 79 15 91 98 20 83 73 87 48 6 52 52 72 44 7 33 88 83 23 47 48 68 2 41 52 19 68 22 64 62 85 33 13 98 16 89 34 97 76 61 44 79 57 57 3 65 47 67 7 41 80 47 47 43 5 31 53 5 32 96 100 5 45 91 37 30 64 29 51 86 77 67 43 2...

output:

212920

result:

ok answer is '212920'

Test #94:

score: 0
Accepted
time: 9ms
memory: 11168kb

input:

300000 47 962
981 529 138 153 856 879 634 332 627 465 495 337 130 732 526 9 801 373 903 530 76 594 581 644 704 254 489 757 648 705 64 645 697 630 424 658 854 436 655 294 596 774 108 140 271 43 932 566 732 406 318 906 893 958 223 984 592 272 880 166 32 968 11 452 874 500 313 776 938 249 550 36 364 16...

output:

82927

result:

ok answer is '82927'

Test #95:

score: 0
Accepted
time: 8ms
memory: 14352kb

input:

300000 471 103
431 7 495 225 31 867 789 810 67 312 585 66 349 649 441 567 819 421 651 820 585 465 438 660 925 411 98 627 170 976 59 374 702 38 858 437 91 843 756 704 185 420 297 223 787 583 846 521 846 458 603 830 493 897 302 797 447 780 287 487 71 246 42 410 363 727 912 910 486 35 270 251 943 890 9...

output:

300000

result:

ok answer is '300000'

Test #96:

score: 0
Accepted
time: 15ms
memory: 12296kb

input:

300000 290002 529744
334269 418581 555165 659707 3992 3722 329947 312549 824982 916515 619 496221 757153 844297 89566 192263 645077 94074 398716 821915 267522 2313 119872 977059 836590 488282 515224 54145 645648 251047 813222 30119 815446 38205 89025 576220 850336 89535 950197 13758 765890 936162 27...

output:

204875

result:

ok answer is '204875'

Test #97:

score: 0
Accepted
time: 4ms
memory: 14268kb

input:

300000 854396 373426
371718 272251 680227 105780 32871 379198 296807 616731 85422 443554 768005 65758 918964 292214 369992 664013 75799 391019 495169 969692 150840 876696 466433 287268 930811 913143 229536 354015 164874 537125 188217 6255 650259 632805 891051 773591 404869 846942 390489 374976 74018...

output:

282250

result:

ok answer is '282250'

Test #98:

score: 0
Accepted
time: 11ms
memory: 12168kb

input:

300000 156083763 615362278
429935056 48713952 338516934 322819267 635766157 262505376 527109420 472020663 634580469 274372714 794614469 784615969 733377162 353526897 777035525 899210619 501724112 65590162 570669474 509059616 409029586 165876937 213899801 646937808 319089819 188079290 927263272 58383...

output:

169540

result:

ok answer is '169540'

Test #99:

score: 0
Accepted
time: 17ms
memory: 12168kb

input:

300000 879375711 498478406
873972506 74343429 317866188 162265340 805729628 310722068 453076279 754324845 13873612 740965161 437447263 104409699 955347485 576199006 765315951 53458177 375154834 209887107 717733223 424174690 629169799 682718616 941246362 77056529 32184041 913728343 950977584 77109876...

output:

225613

result:

ok answer is '225613'