QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#737067 | #7646. 优惠购物 | int_R | 10 | 129ms | 19332kb | C++23 | 1.2kb | 2024-11-12 14:31:56 | 2024-11-12 14:31:56 |
Judging History
answer
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define int long long
using namespace std;
const int MAXN=1e6+10;
int T,n,m,c,a[MAXN],b[MAXN],cost,cnt;
priority_queue <int,vector<int>,greater<int>> q;
inline void work()
{
while(!q.empty()) q.pop();
cost=cnt=0;cin>>n>>m>>c;
for(int i=1;i<=n;++i) cin>>a[i];
for(int i=1;i<=n;++i)
{
cin>>b[i],b[i]=min(b[i],a[i]);
while(!q.empty()&&m<b[i])
{
int cur=b[i]-m,x=q.top();
if(cur<x) break;
else cost+=x,m+=(x+1),q.pop();
}
if(m<b[i])
{
int cur=b[i]-m,s=min(cur/(c+1),cnt);
cost+=s*c,m+=s*(c+1),cnt-=s;
cur=b[i]-m;if(cnt&&cur==c)
cost+=c,m+=c+1,cnt-=1;
}
int use=min(m,b[i]),now=a[i]-use;
m-=use,cost+=now,m+=now/c;
int num=c-now%c;
if(num<=use) q.push(num),cnt+=(use-num)/c;
}
cout<<cost<<'\n';return ;
}
signed main()
{
// freopen("coupon6.in","r",stdin);
// freopen("out.out","w",stdout);
cin.tie(0),cout.tie(0);
ios::sync_with_stdio(0);
cin>>T;while(T--) work();return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5628kb
input:
5 10 9 8 10 5 1 2 10 9 2 9 8 8 5 3 1 1 7 2 2 1 3 0 10 1 5 3 2 6 10 5 10 1 4 8 1 1 2 5 6 2 3 1 3 6 1 10 6 10 5 4 9 5 4 10 8 5 2 4 2 4 2 5 1 1 7 5 0 0 10 5 10 6 2 7 4 3 8 10 5 5 4 1 0 6 3 3 5 4 5 0 0 10 6 12 6 8 7 3 1 4 10 2 9 10 0 3 1 3 1 3 1 0 4 7
output:
51 43 49 48 54
result:
wrong answer 2nd lines differ - expected: '42', found: '43'
Subtask #2:
score: 10
Accepted
Test #4:
score: 10
Accepted
time: 125ms
memory: 19332kb
input:
1 1000000 75424149 4 15519624 393474467 66570532 20552964 884794646 633920424 885627436 891022137 207531470 263467015 853563838 909020263 225156643 843397191 555130236 28501962 70380880 400094075 351542363 118716292 772000502 495729611 777038576 845271464 346378405 179347308 90713310 683636539 92786...
output:
400011543086868
result:
ok single line: '400011543086868'
Test #5:
score: 10
Accepted
time: 122ms
memory: 19276kb
input:
1 1000000 290027657 13 304913277 796843021 516017645 319050677 454050563 311934679 136029540 790505371 382952680 125583971 728245481 902515808 812248168 868676972 790078499 415156440 464267202 582710403 940789661 787826252 967007727 383461878 355142003 38823668 153257857 934717389 686901242 36112867...
output:
464602224908438
result:
ok single line: '464602224908438'
Test #6:
score: 10
Accepted
time: 129ms
memory: 7820kb
input:
100 10000 555225459 12 283175257 921770254 7299205 304241949 267180864 651891533 164511492 581458656 706908893 739975249 933584512 596665557 469159082 990911824 978336498 995722553 404329338 864926421 108033148 939393219 883683355 155563579 13934792 536244919 137715285 306298646 959297422 220012187 ...
output:
4588217379181 4629253346598 4052616322788 4685633463207 4611498546635 3286925309424 4700753892257 4389905037385 4633607365103 4688195153421 4178811594145 4752054242985 4664825925836 4665776689820 3962158296116 4640134664463 3364786516333 4529228891211 4651138496620 4597397577514 3343211719775 377293...
result:
ok 100 lines
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #3:
0%
Subtask #5:
score: 0
Skipped
Dependency #4:
0%
Subtask #6:
score: 0
Wrong Answer
Test #24:
score: 15
Accepted
time: 2ms
memory: 5700kb
input:
600 10 21 2 1434256 1792820 8964100 10756920 6454152 717128 9681228 7529844 7171280 10398356 1075692 1075692 1434256 10039792 358564 717128 717128 5737024 3227076 1792820 10 5 4 5500368 6875460 4125274 687544 5500368 4469049 4125276 2750183 9969416 5156593 4469049 3781503 687546 0 1718865 343773 0 2...
output:
46254742 42284068 28465970 36815342 18797080 16608540 59809954 55963386 98157466 99455211 58990996 4474138 59994584 40677040 117326435 26562075 51644186 94269994 59007134 38720301 55628210 40921356 30237996 20727720 83424160 84045033 66629574 18910773 84890678 72094414 49832625 110722258 1360310 120...
result:
ok 600 lines
Test #25:
score: 15
Accepted
time: 19ms
memory: 5644kb
input:
2000 10 19 8 6876660 3438330 687664 11690316 2062992 2062992 2062992 687666 687666 1375330 6876660 2062998 0 5501328 0 0 0 687666 687666 687666 10 15 3 4087344 17371212 15327539 13283868 16349376 9196524 5109180 16349376 7152852 2043672 4087344 15327540 12262032 0 0 2043672 4087344 7152852 4087344 2...
output:
28194264 79703196 11089764 62810972 41503410 26040944 91781613 70998177 18207816 55013070 7566990 59042320 17974772 28271700 5677866 9725704 1225548 29982198 17802890 343025 45817818 73177656 86443886 15493720 79583772 32225792 56508512 62526146 37987857 105719026 44344500 16914540 65295200 2337432 ...
result:
ok 2000 lines
Test #26:
score: 0
Wrong Answer
time: 17ms
memory: 5892kb
input:
10 20000 5 2 7 8 3 4 8 6 4 4 10 3 7 10 9 5 10 10 2 4 1 9 3 5 5 4 5 10 2 7 4 5 8 5 5 6 8 0 6 10 7 4 8 10 9 4 4 8 2 9 1 10 9 6 10 6 0 0 3 9 7 8 9 7 2 6 0 2 6 10 2 3 8 7 4 2 4 3 1 4 10 8 9 9 0 6 6 6 9 6 9 3 5 7 2 10 4 7 4 0 1 4 6 8 10 0 2 4 8 3 9 7 1 6 2 3 0 10 4 10 7 6 2 6 2 1 3 4 6 6 6 5 0 7 9 4 6 4 ...
output:
71970 80346 80978 80828 78718 78528 78536 80857 71616 80803
result:
wrong answer 1st lines differ - expected: '71942', found: '71970'
Subtask #7:
score: 0
Skipped
Dependency #6:
0%
Subtask #8:
score: 0
Skipped
Dependency #6:
0%
Subtask #9:
score: 0
Skipped
Dependency #2:
100%
Accepted
Dependency #5:
0%