Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: chokun

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-13 09:01:09

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

int main(){
    int n;
    cin >> n;

    long long sum_winner_price = 0;
    int current_max_win = -1;

    for (int i = 0; i < n; i++){
        int price;
        cin >> price;

        if(i == 0 || price > current_max_win){
            sum_winner_price += price;
            current_max_win = price;
        }
    }
    
    cout << sum_winner_price;
}