QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555600#8586. Partymohamed_ioi0 14ms10692kbPython3253b2024-09-10 06:07:592024-09-10 06:07:59

Judging History

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

  • [2024-09-10 06:07:59]
  • 评测
  • 测评结果:0
  • 用时:14ms
  • 内存:10692kb
  • [2024-09-10 06:07:59]
  • 提交

answer

n= int(input())
a = list(map(int, input().split(' ')))

if n == 1:
    print(a[0])
else:
    dp = [0] * n
    dp[0] = a[0]
    dp[1] = max(a[1], a[0])

    for i in range(2, n):
        dp[i] = max(a[i] + dp[i - 2], a[i] + dp[i-1])

    print(dp[n - 1])

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 49
Accepted
time: 7ms
memory: 10636kb

input:

5
3 2 -1 4 5

output:

12

result:

ok single line: '12'

Test #2:

score: 49
Accepted
time: 14ms
memory: 10692kb

input:

1
10

output:

10

result:

ok single line: '10'

Test #3:

score: 0
Wrong Answer
time: 14ms
memory: 10576kb

input:

6
1 -3 2 10 -4 9

output:

22

result:

wrong answer 1st lines differ - expected: '21', found: '22'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%