Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: cyblox_boi
Problemset: ประมูลการกุศล
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-22 20:33:57
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> auctions(n);
for (int i = 0; i < n; i++) {
cin >> auctions[i];
}
vector<int> wins = {auctions[0]};
for (int i = 1; i < n; i++) {
if (auctions[i] > wins[wins.size() - 1]) {
wins.push_back(auctions[i]);
}
}
cout << accumulate(wins.begin(), wins.end(), 0) << '\n';
return 0;
}