QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#556482 | #8586. Party | allaeben | 0 | 0ms | 3636kb | C++14 | 554b | 2024-09-10 18:49:05 | 2024-09-10 18:49:06 |
answer
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n;
cin >> n;
int a[n];
for(int i = 0; i < n; i++) {
cin >> a[i];
}
if (n == 1) {
cout << max(0, a[0]) << endl;
return 0;
}
int balakyjo2 = max(0, a[0]);
int balakyjo1 = max(balakyjo2, a[1]);
for (int i = 2; i < n; i++) {
int current = max(balakyjo1, a[i] + balakyjo2);
balakyjo2 = balakyjo1;
balakyjo1 = current;
}
cout << balakyjo1 << endl;
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3636kb
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%