Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Nuttykub

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-02 10:52:53

#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int top,total;
    cin >> total;
    top = total;
    for (int i = 1;i < n;i++){
        int a;
        cin >> a;
        if (a > top) {
            total+=a;
            top = a;
        }
    }
    cout <<total;
}