QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96552 | #5591. Fading Wind | PetroTarnavskyi# | AC ✓ | 2ms | 3448kb | C++17 | 784b | 2023-04-14 14:35:27 | 2023-04-14 14:35:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second
typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
LL h, k, v, s;
cin >> h >> k >> v >> s;
LL x = 0;
while (h > 0) {
v += s;
v -= max(1LL, v / 10);
if (v >= k) {
h++;
}
if (0 < v && v < k) {
h--;
if (h == 0) {
v = 0;
}
}
if (v <= 0) {
h = 0;
v = 0;
}
x += v;
if (s > 0) {
s--;
}
}
cout << x << "\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3244kb
input:
1 1 1 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3356kb
input:
2 2 2 2
output:
9
result:
ok single line: '9'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
1 2 3 4
output:
68
result:
ok single line: '68'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
314 159 265 358
output:
581062
result:
ok single line: '581062'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
1000 1000 1000 1000
output:
4513860
result:
ok single line: '4513860'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3388kb
input:
1000 1 1000 1000
output:
4513860
result:
ok single line: '4513860'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3320kb
input:
1000 1000 1 1000
output:
4504869
result:
ok single line: '4504869'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3364kb
input:
1000 1000 1000 1
output:
9179
result:
ok single line: '9179'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3276kb
input:
1 1000 1000 1000
output:
4513860
result:
ok single line: '4513860'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3356kb
input:
1 1 1000 1000
output:
4513860
result:
ok single line: '4513860'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
1 1000 1 1000
output:
0
result:
ok single line: '0'
Test #12:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
1 1000 1000 1
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
1000 1 1 1000
output:
4504869
result:
ok single line: '4504869'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3384kb
input:
1000 1 1000 1
output:
9179
result:
ok single line: '9179'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3384kb
input:
1000 1000 1 1
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3244kb
input:
999 1 999 999
output:
4504850
result:
ok single line: '4504850'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3372kb
input:
100 100 100 100
output:
46613
result:
ok single line: '46613'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
1000 1 1 1
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3312kb
input:
1 1000 1 1
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 2ms
memory: 3352kb
input:
1 1 1000 1
output:
9179
result:
ok single line: '9179'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3308kb
input:
1 1 1 1000
output:
4504869
result:
ok single line: '4504869'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3296kb
input:
535 425 827 311
output:
444405
result:
ok single line: '444405'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3240kb
input:
984 375 297 179
output:
147948
result:
ok single line: '147948'
Test #24:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
785 723 722 554
output:
1390470
result:
ok single line: '1390470'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3276kb
input:
678 285 113 940
output:
3981799
result:
ok single line: '3981799'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3296kb
input:
28 255 394 835
output:
3145213
result:
ok single line: '3145213'
Test #27:
score: 0
Accepted
time: 1ms
memory: 3320kb
input:
765 430 259 881
output:
3499391
result:
ok single line: '3499391'
Test #28:
score: 0
Accepted
time: 2ms
memory: 3360kb
input:
514 822 326 656
output:
1942752
result:
ok single line: '1942752'
Test #29:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
867 701 968 742
output:
2489959
result:
ok single line: '2489959'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3276kb
input:
412 141 565 64
output:
24003
result:
ok single line: '24003'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
144 833 811 897
output:
3632429
result:
ok single line: '3632429'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3240kb
input:
202 155 904 723
output:
2364034
result:
ok single line: '2364034'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3376kb
input:
546 573 822 979
output:
4325137
result:
ok single line: '4325137'
Test #34:
score: 0
Accepted
time: 2ms
memory: 3240kb
input:
703 216 339 553
output:
1382052
result:
ok single line: '1382052'
Test #35:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
127 904 733 655
output:
1940529
result:
ok single line: '1940529'
Test #36:
score: 0
Accepted
time: 0ms
memory: 3284kb
input:
71 317 420 84
output:
36151
result:
ok single line: '36151'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3380kb
input:
520 963 880 486
output:
1073341
result:
ok single line: '1073341'
Test #38:
score: 0
Accepted
time: 2ms
memory: 3388kb
input:
656 615 146 699
output:
2203518
result:
ok single line: '2203518'
Test #39:
score: 0
Accepted
time: 0ms
memory: 3284kb
input:
832 419 833 519
output:
1222286
result:
ok single line: '1222286'
Test #40:
score: 0
Accepted
time: 2ms
memory: 3380kb
input:
943 345 19 444
output:
889596
result:
ok single line: '889596'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3448kb
input:
382 586 53 919
output:
3805521
result:
ok single line: '3805521'
Test #42:
score: 0
Accepted
time: 2ms
memory: 3240kb
input:
771 757 364 52
output:
15903
result:
ok single line: '15903'
Test #43:
score: 0
Accepted
time: 2ms
memory: 3320kb
input:
983 489 384 594
output:
1594253
result:
ok single line: '1594253'
Test #44:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
793 6 889 416
output:
788940
result:
ok single line: '788940'
Test #45:
score: 0
Accepted
time: 2ms
memory: 3408kb
input:
245 120 571 219
output:
222225
result:
ok single line: '222225'
Test #46:
score: 0
Accepted
time: 2ms
memory: 3316kb
input:
981 255 540 981
output:
4340284
result:
ok single line: '4340284'
Test #47:
score: 0
Accepted
time: 0ms
memory: 3436kb
input:
369 60 274 66
output:
22616
result:
ok single line: '22616'
Test #48:
score: 0
Accepted
time: 2ms
memory: 3356kb
input:
806 283 198 766
output:
2646006
result:
ok single line: '2646006'
Test #49:
score: 0
Accepted
time: 2ms
memory: 3240kb
input:
619 849 569 546
output:
1349469
result:
ok single line: '1349469'
Test #50:
score: 0
Accepted
time: 1ms
memory: 3284kb
input:
567 924 133 257
output:
299855
result:
ok single line: '299855'
Test #51:
score: 0
Accepted
time: 0ms
memory: 3304kb
input:
675 315 939 357
output:
583904
result:
ok single line: '583904'
Test #52:
score: 0
Accepted
time: 2ms
memory: 3400kb
input:
327 175 341 97
output:
46120
result:
ok single line: '46120'
Test #53:
score: 0
Accepted
time: 1ms
memory: 3300kb
input:
931 589 593 802
output:
2903738
result:
ok single line: '2903738'
Test #54:
score: 0
Accepted
time: 0ms
memory: 3448kb
input:
280 344 10 52
output:
12727
result:
ok single line: '12727'