QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#462964#7646. 优惠购物bribritt0 499ms27120kbC++17567b2024-07-04 10:32:262024-07-04 10:32:26

Judging History

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

  • [2024-07-04 10:32:26]
  • 评测
  • 测评结果:0
  • 用时:499ms
  • 内存:27120kb
  • [2024-07-04 10:32:26]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
  int n, m, c; cin >> n >> m >> c;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=0;i<n;i++) cin>>a[i];
  int v[n], g[n];
  for(int i=0;i<n;i++) v[i]=(a[i]%c), g[i]=(a[i]/c);
  int cst = 0, s = 0;
  for(int i=n;i--;) {
    g[i]=min(s,a[i]/c);
    v[i]=a[i]-c*g[i];
    cst += c*g[i];
    s += v[i] - g[i];
  }
  if(m<=s) cout<<cst+s-m<<"\n";
  else cout<<max(0LL,cst+s-m+(m-s-1)/(c+1)+1)<<"\n";
}
main() {
  int t; cin >> t;
  while(t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3640kb

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:

16
26
21
22
17

result:

wrong answer 1st lines differ - expected: '51', found: '16'

Subtask #2:

score: 0
Wrong Answer

Test #4:

score: 10
Accepted
time: 499ms
memory: 27076kb

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: 0
Accepted
time: 499ms
memory: 27120kb

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
Wrong Answer
time: 489ms
memory: 3864kb

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
4700768822818
4389905037385
4633624195169
4688195153421
4178811594145
4752054242985
4664825925836
4665787997784
3962158296116
4640136897177
3364786516333
4529228891211
4651161092357
4597400872429
3343334142744
377293...

result:

wrong answer 7th lines differ - expected: '4700753892257', found: '4700768822818'

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: 0
Wrong Answer
time: 4ms
memory: 3560kb

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:

17569615
11258557
9410231
16566885
6591178
5536179
21424450
20706438
31550608
37429375
24788756
1872891
20301186
24322349
43633795
6421596
23352139
52791191
23116194
11869613
17296159
20999098
8992340
7421016
25994469
29947070
33314782
4694176
25620150
26957036
17781174
34964907
828013
38431619
4118...

result:

wrong answer 1st lines differ - expected: '46254742', found: '17569615'

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 0
Skipped

Dependency #6:

0%

Subtask #9:

score: 0
Skipped

Dependency #2:

0%