QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#536583 | #836. Farm of Monsters | ship2077 | WA | 9ms | 3952kb | C++14 | 564b | 2024-08-29 14:47:27 | 2024-08-29 14:47:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int M=3e5+5;
long long cnt;int n,a,b,ans;
priority_queue<int>q;
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
int main(){ cnt=1;
n=read();a=read();b=read();
for (int i=1;i<=n;i++){
int x=read(),tmp=(x+b-1)/b;
cnt+=tmp;x=(x-(tmp-1)*b+a-1)/a+1;
if (x<=cnt) ans++,cnt-=x;
else if (!q.empty()&&q.top()>x)
cnt+=x-q.top(),q.pop(),q.push(x);
}
printf("%d\n",ans);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
3 1 1 1 1 1
output:
2
result:
ok answer is '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
3 1 1 2 2 2
output:
3
result:
ok answer is '3'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3892kb
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: 9ms
memory: 3764kb
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: 9ms
memory: 3788kb
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: 6ms
memory: 3836kb
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: 9ms
memory: 3756kb
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: 9ms
memory: 3784kb
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: 9ms
memory: 3840kb
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: 9ms
memory: 3844kb
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: 9ms
memory: 3824kb
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: 6ms
memory: 3844kb
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: 9ms
memory: 3812kb
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: 6ms
memory: 3832kb
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: 9ms
memory: 3784kb
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: 0ms
memory: 3764kb
input:
1 1 1 1
output:
1
result:
ok answer is '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 1 1 5
output:
1
result:
ok answer is '1'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
1 1 2 2
output:
0
result:
ok answer is '0'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 2 1 2
output:
1
result:
ok answer is '1'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
1 7 9 3
output:
1
result:
ok answer is '1'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
1 7 3 9
output:
1
result:
ok answer is '1'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 7 51 50
output:
0
result:
ok answer is '0'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
1 79 51 96
output:
1
result:
ok answer is '1'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 60 820 533
output:
0
result:
ok answer is '0'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 664 188 495
output:
1
result:
ok answer is '1'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1 297208 929600 614363
output:
0
result:
ok answer is '0'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
1 589156 45728 619108
output:
1
result:
ok answer is '1'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
1 505899152 526332989 621636272
output:
1
result:
ok answer is '1'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
1 409449117 374415292 920449529
output:
1
result:
ok answer is '1'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
2 1 1 1 1
output:
1
result:
ok answer is '1'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
2 1 1 3 1
output:
2
result:
ok answer is '2'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 1 1 2 1
output:
2
result:
ok answer is '2'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 2 1 2 1
output:
2
result:
ok answer is '2'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
2 5 6 9 9
output:
2
result:
ok answer is '2'
Test #35:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 10 9 1 7
output:
1
result:
ok answer is '1'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 4 77 3 29
output:
1
result:
ok answer is '1'
Test #37:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
2 33 29 49 7
output:
2
result:
ok answer is '2'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 982 988 630 233
output:
1
result:
ok answer is '1'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
2 833 406 183 414
output:
2
result:
ok answer is '2'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
2 311557 743280 610538 535909
output:
1
result:
ok answer is '1'
Test #41:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
2 394981 292125 391092 198091
output:
2
result:
ok answer is '2'
Test #42:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
2 578786981 772798219 803767815 685001280
output:
1
result:
ok answer is '1'
Test #43:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
2 756870405 346347063 247805265 415663462
output:
2
result:
ok answer is '2'
Test #44:
score: 0
Accepted
time: 0ms
memory: 3836kb
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: 3784kb
input:
10 1 1 4 5 2 5 3 5 3 2 1 2
output:
10
result:
ok answer is '10'
Test #46:
score: -100
Wrong Answer
time: 0ms
memory: 3832kb
input:
10 1 2 2 2 2 1 1 2 1 1 1 2
output:
4
result:
wrong answer expected '5', found '4'