Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: loop
Problemset: ประมูลการกุศล
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-10 18:31:41
#include <iostream>
using namespace std;
// A bid wins when it is higher than every earlier bid (the first bid always wins).
int main() {
int n;
cin >> n;
long long best = 0, sum = 0;
for (int i = 0; i < n; i++) {
long long x;
cin >> x;
if (i == 0 || x > best) { best = x; sum += x; }
}
cout << sum << '\n';
return 0;
}