QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#46897 | #2283. Decelerating Jump | njian | TL | 129ms | 74592kb | C++ | 644b | 2022-09-02 14:59:47 | 2022-09-02 14:59:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n;
int a[3010];
ll f[3010][3010];
ll ans;
int main ()
{
scanf("%d",&n);
ans=-1e18;memset(f,-0x3f,sizeof(f));
for(int i=1;i<=n;i++){scanf("%d",&a[i]);f[1][i]=0;}
f[2][1]=a[2];
if(n==2){cout<<a[1]+a[2];return 0;}
for(int i=3;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
for(int k=j;;k++)
{
if(i-k>=1)f[i][j]=max(f[i][j],a[i]+f[i-k][k]);
else break;
}
if(i==n)ans=max(ans,f[i][j]);
}
}
cout<<ans+a[1];
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 122ms
memory: 74548kb
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: 120ms
memory: 74524kb
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: 127ms
memory: 74436kb
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: 129ms
memory: 74532kb
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: 129ms
memory: 74592kb
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: 125ms
memory: 74520kb
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: 2ms
memory: 74384kb
input:
2 0 0
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 21ms
memory: 74592kb
input:
2 -1 -9
output:
-10
result:
ok single line: '-10'
Test #9:
score: 0
Accepted
time: 15ms
memory: 74588kb
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: 22ms
memory: 74436kb
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: 33ms
memory: 74452kb
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: 4ms
memory: 74524kb
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: 19ms
memory: 74444kb
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: 13ms
memory: 74552kb
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: 11ms
memory: 74512kb
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: 21ms
memory: 74592kb
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...