QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555637#8586. PartyJioru0 0ms3564kbC++20501b2024-09-10 07:11:402024-09-10 07:11:41

Judging History

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

  • [2024-09-10 07:11:41]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3564kb
  • [2024-09-10 07:11:40]
  • 提交

answer

#include <iostream>
#include <algorithm>
using namespace std;
int main() {
    int n;
    cin >> n;
    if (n == 0) {
        cout << 0 << endl;
        return 0;
    }
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    int prev1 = 0;
    int prev2 = 0;
    for (int i = 0; i < n; ++i) {
        int current = max(prev1, prev2 + a[i]);
        prev2 = prev1;
        prev1 = current;
    }
    cout << prev1 << endl;    //t5bich babe 
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3564kb

input:

5
3 2 -1 4 5

output:

8

result:

wrong answer 1st lines differ - expected: '12', found: '8'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%