Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: punzacp555

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-05 22:10:56

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

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

    int n;
    cin >> n;

    int mx;
    cin >> mx;
    int ans = mx;
    while(--n) {
        int x;
        cin >> x;

        if(x > mx) mx = x, ans += x;
    }

    cout << ans;
    
    return 0;
}