QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#202276 | #2283. Decelerating Jump | MaGnsi0# | TL | 173ms | 11072kb | C++17 | 788b | 2023-10-05 21:21:44 | 2023-10-05 21:21:44 |
Judging History
answer
/**
* author: MaGnsi0
* created: 05.10.2023 16:13:15
**/
#include <bits/stdc++.h>
using namespace std;
const int64_t OO = 3e15;
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
vector<int64_t> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
vector<vector<int64_t>> dp(n, vector<int64_t>(n, INT64_MIN));
function<int64_t(int, int)> solve = [&](int x, int y) {
if (x == n - 1) { return a[x]; }
if (dp[x][y] != INT64_MIN) { return dp[x][y]; }
dp[x][y] = -OO;
for (int j = 1; j <= y && x + j < n; ++j) {
dp[x][y] = max(dp[x][y], solve(x + j, j) + a[x]);
}
return dp[x][y];
};
cout << solve(0, n - 1);
}
详细
Test #1:
score: 100
Accepted
time: 166ms
memory: 10972kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 172ms
memory: 11008kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
3
result:
ok single line: '3'
Test #3:
score: 0
Accepted
time: 162ms
memory: 11072kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
7
result:
ok single line: '7'
Test #4:
score: 0
Accepted
time: 169ms
memory: 11060kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
12
result:
ok single line: '12'
Test #5:
score: 0
Accepted
time: 173ms
memory: 11060kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
27
result:
ok single line: '27'
Test #6:
score: 0
Accepted
time: 171ms
memory: 11016kb
input:
1000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0...
output:
35
result:
ok single line: '35'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 0 0
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
2 -1 -9
output:
-10
result:
ok single line: '-10'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
10 -1 0 1 0 0 0 1 1 1 -1
output:
2
result:
ok single line: '2'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
20 -2 -2 -1 -1 -2 1 0 1 2 3 -1 2 1 3 2 3 -1 -2 -1 3
output:
14
result:
ok single line: '14'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 3 10 -2 -9 4 -7 5 -7 -4 -5
output:
3
result:
ok single line: '3'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
50 -8 -3 -9 -9 -4 -8 7 -4 -10 -4 8 -9 -6 1 7 2 0 -3 7 3 -7 -9 -9 -9 6 -7 -2 -10 2 8 -10 -5 6 -4 -3 7 -8 -6 9 5 3 -4 9 1 10 8 0 -1 2 6
output:
82
result:
ok single line: '82'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3732kb
input:
100 -64 65 -52 -25 39 -83 23 30 35 51 22 73 20 -18 -29 90 44 28 -34 -88 -79 -49 57 -63 86 -6 -92 28 44 41 73 8 -83 18 -25 40 29 87 50 22 -5 96 99 -74 60 -18 92 21 -65 -78 -17 -25 -8 49 69 -78 -82 92 83 -14 33 90 57 19 65 -50 -19 -77 74 -11 54 21 72 -55 -66 -43 -44 94 -27 46 -74 64 -8 -45 -78 14 -6 -...
output:
834
result:
ok single line: '834'
Test #14:
score: 0
Accepted
time: 0ms
memory: 4028kb
input:
200 -592 -939 223 74 -372 736 38 -455 735 -998 422 331 -740 142 38 -561 70 765 764 -839 -882 373 -174 938 -679 -33 596 98 -732 142 89 981 -743 -284 790 -289 -908 -830 -666 122 314 299 -192 545 119 -842 -113 934 -580 -72 60 -349 659 -562 885 835 629 -888 366 -245 -260 25 -193 683 -734 979 209 219 922...
output:
14459
result:
ok single line: '14459'
Test #15:
score: 0
Accepted
time: 5ms
memory: 3880kb
input:
300 -1282 5441 4865 -1420 -8118 6740 -2338 8435 -1095 3910 -9689 5258 -6414 8818 -1922 4168 6575 3345 -7739 -1709 -2456 -129 -9151 -4377 -9100 -1500 7944 9614 9380 -1510 4084 -3084 -3499 6851 -7316 7517 -172 1923 6690 -9334 639 -7411 55 -6105 4174 -7667 -9254 3848 -7194 9846 4137 -6914 -1023 6028 91...
output:
222431
result:
ok single line: '222431'
Test #16:
score: 0
Accepted
time: 23ms
memory: 5164kb
input:
500 -9312 3629 8352 -7728 5135 81 -959 251 -9992 -4873 6875 1153 2051 -559 7920 2726 9524 -2830 -4068 9650 -9989 3902 -4634 -4342 -6615 3225 -6581 -2189 -7899 8427 -8501 5663 -7532 -3316 -31 7085 912 7165 5484 5435 1439 9351 9059 1071 -7166 -7371 -6786 -2978 -1303 -2821 -90 827 -2934 -4066 6413 -265...
output:
334460
result:
ok single line: '334460'
Test #17:
score: -100
Time Limit Exceeded
input:
2990 -970733755 373162926 610706002 746420415 -24022769 446900035 80395723 -518380142 727642894 -802578839 -299221072 790023549 812359052 558846138 816832324 987432334 802786331 -460777465 821945862 -928082137 -166432503 927724630 -663110602 304682374 -219146966 -229896662 -389891025 508234675 55873...