Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: chs_14

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-01-20 15:18:46

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

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

    int n, maxprice=-1, price, winnersum=0;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> price;
        if (price>maxprice) {
            maxprice=price;
            winnersum+=maxprice;
        }
    }
    cout << winnersum << '\n';

    return 0;
}