QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#395028 | #2698. Flip Flow | kevinyang# | AC ✓ | 0ms | 3888kb | C++17 | 434b | 2024-04-21 01:35:17 | 2024-04-21 01:35:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int t,s,n;
cin >> t >> s >> n;
vector<int>a(n+1);
for(int i = 1; i<=n; i++){
cin >> a[i];
}
int x = s;
int y = 0;
for(int i = 1; i<=n; i++){
int diff = a[i]-a[i-1];
int v = min(y,diff);
y-=v;
x+=v;
swap(x,y);
}
y-=t-a[n];
cout << max(0LL,y) << '\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3528kb
input:
100 80 1 50
output:
30
result:
ok single line: '30'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
100 30 1 50
output:
0
result:
ok single line: '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
100 50 2 30 79
output:
28
result:
ok single line: '28'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
100 50 2 30 80
output:
30
result:
ok single line: '30'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
100 50 2 30 81
output:
31
result:
ok single line: '31'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
10 7 2 4 9
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
2 1000000 1 1
output:
999999
result:
ok single line: '999999'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
10 1 9 1 2 3 4 5 6 7 8 9
output:
0
result:
ok single line: '0'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
11 1 10 1 2 3 4 5 6 7 8 9 10
output:
0
result:
ok single line: '0'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
1000000 1000000 1000 344 537 560 846 1947 2404 4212 6558 7411 8239 8807 10613 10967 11501 12280 13635 17353 17646 19480 20208 20940 21130 22176 22890 23738 25718 26413 26859 28252 29024 29808 31057 31339 34445 35596 37005 37050 37133 39154 39685 40345 41332 42262 43972 44905 46263 46428 47025 47742 ...
output:
41406
result:
ok single line: '41406'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
2000 333 3 1000 1250 1500
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
100 10 5 15 20 93 96 97
output:
5
result:
ok single line: '5'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
616658 68644 966 365 664 1505 2432 3458 3807 4532 4795 5425 5891 5949 7209 7416 7666 8836 8958 9037 9659 10899 11894 11972 12448 12867 12892 12942 13560 13677 15213 15858 16339 16717 17213 17511 17869 18089 19066 19524 19747 20537 21087 21365 21593 21701 22336 22555 22677 24240 25230 26585 29190 297...
output:
10727
result:
ok single line: '10727'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
264267 163935 485 32 116 650 830 886 1485 1498 1976 2435 3076 3167 3965 4054 4103 5572 6783 6806 7836 8673 8822 9205 9733 10487 11915 12103 12215 13140 13562 13754 14482 14643 15135 15481 15660 16638 16826 18518 18538 19466 19702 20130 20582 21467 21790 22051 23354 23858 24548 24662 25613 25670 2605...
output:
148158
result:
ok single line: '148158'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
290852 685196 940 168 657 676 826 894 955 1174 1523 1677 2140 2317 2992 3052 3740 4137 4926 4999 5010 5100 5541 5797 5847 6170 6911 7009 7102 7120 7358 7544 7752 7783 8767 9033 9067 9338 9852 9892 10178 10979 11488 11802 11827 11932 12228 13255 13644 13714 13916 14333 14640 14718 15152 15379 15519 1...
output:
11688
result:
ok single line: '11688'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
331962 696222 138 31 1877 3009 7552 9505 11088 11293 12557 17097 19693 24059 27288 27562 28711 29630 33002 34111 39445 42601 53983 54291 62804 63897 64228 65440 65462 66099 68468 72308 72430 73158 76084 77804 78346 78946 82518 84667 84879 88869 89535 99834 100516 101195 101333 106761 106838 107085 1...
output:
10175
result:
ok single line: '10175'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
490236 710967 510 55 218 459 572 3052 3930 4647 4995 5985 6986 10236 10756 11196 11319 13697 13960 14952 16550 18485 20446 20857 21087 22122 22986 24956 25454 27927 27988 30545 30589 31120 31570 31802 33173 33755 34308 34777 36463 38165 38603 38967 39125 41104 42218 42914 43811 46774 48559 49364 494...
output:
3345
result:
ok single line: '3345'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
887557 280821 184 10054 14407 15602 18476 20179 21802 28240 29993 34632 53225 53679 60018 60562 65878 75758 77968 82002 85631 88380 91371 94131 116192 124559 125848 141179 147583 161654 168831 170772 178438 186152 186734 191001 191384 196776 196909 203432 205581 209693 210738 215533 220170 220957 22...
output:
22405
result:
ok single line: '22405'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
931066 503685 810 222 936 1338 2217 2574 2695 2702 4306 7070 8178 9295 10334 14006 15568 16098 18157 19264 19623 21185 21468 22497 24922 25039 26677 29074 29248 34505 35713 37586 37762 38099 40047 40775 41287 41845 43451 43660 44067 47925 50405 51436 51477 53887 54378 56136 56592 59173 59272 59549 6...
output:
55443
result:
ok single line: '55443'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
367830 447254 734 2278 2475 2654 3942 4002 4003 4841 6140 6291 6643 7141 8928 9261 10897 11494 11598 11927 14174 15395 15921 16253 16791 17770 17787 17829 18155 18482 18616 19527 19677 21353 21678 22610 22686 23268 23360 24097 24816 24931 25338 25494 25555 25606 25912 25933 27109 27198 27545 27603 2...
output:
19750
result:
ok single line: '19750'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
4572 803351 812 6 9 11 20 24 25 33 35 47 60 61 64 66 79 83 85 92 94 95 96 102 106 135 139 143 147 150 152 154 157 159 173 186 188 201 206 210 215 221 225 232 238 239 246 252 254 256 262 263 269 279 283 288 289 295 296 307 316 323 325 331 337 343 355 356 360 371 376 379 380 388 391 392 393 413 422 42...
output:
14
result:
ok single line: '14'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
686456 305829 992 5 555 875 1485 1702 1771 1938 2099 3296 4688 5285 6743 7821 9404 11077 11143 13575 14287 15467 15607 15663 16346 16648 18197 19516 19702 20929 24002 24405 28461 29021 29103 29452 30368 33602 33636 35320 35416 37027 38150 38705 38823 38902 39357 40238 40300 40874 41096 41728 41764 4...
output:
15922
result:
ok single line: '15922'