Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Folk_DIWA

Problemset: ประมูลการกุศล

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-13 23:40:33

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main(){
    cin.tie(0)->sync_with_stdio(0);

    vector <int> ans = {0};

    int n; cin >> n;
    while(n--){

        int x; cin >> x;
        if(x > ans.back()) ans.push_back(x);

    }

    int sum = 0;
    for(auto &x : ans) sum += x;
    cout << sum;

    return 0;
}