Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: tl.cpp

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

Language: cpp

Time: 0.005 second

Submitted On: 2026-08-04 03:02:08

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n, sum;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);

    cin >> n;
    int mx = -1;
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        if (x > mx) {
            sum += x;
            mx = x;
        }
    }
    cout << sum;
}