QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#46896#2283. Decelerating JumpnjianWA 135ms74544kbC++676b2022-09-02 14:52:002022-09-02 14:52:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-02 14:52:03]
  • 评测
  • 测评结果:WA
  • 用时:135ms
  • 内存:74544kb
  • [2022-09-02 14:52:00]
  • 提交

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>=2)f[i][j]=max(f[i][j],a[i]+f[i-k][k]);
                else {f[i][j]=max(f[i][j],1ll*a[i]);break;}
            }
            if(i==n)ans=max(ans,f[i][j]);
        }
    }
   cout<<ans+a[1];
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 122ms
memory: 74328kb

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: 135ms
memory: 74440kb

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: 121ms
memory: 74320kb

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: 125ms
memory: 74536kb

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: 131ms
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 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: 130ms
memory: 74444kb

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: 7ms
memory: 74448kb

input:

2
0 0

output:

0

result:

ok single line: '0'

Test #8:

score: 0
Accepted
time: 9ms
memory: 74544kb

input:

2
-1 -9

output:

-10

result:

ok single line: '-10'

Test #9:

score: 0
Accepted
time: 23ms
memory: 74380kb

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: 8ms
memory: 74520kb

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: 12ms
memory: 74320kb

input:

10
3 10 -2 -9 4 -7 5 -7 -4 -5

output:

3

result:

ok single line: '3'

Test #12:

score: -100
Wrong Answer
time: 4ms
memory: 74528kb

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:

84

result:

wrong answer 1st lines differ - expected: '82', found: '84'