Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Bestzu

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-14 10:13:05

#include<bits/stdc++.h>
#define endl '\n'
using namespace std;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);

   int n; cin >> n;
   int ans = 0;
   int mx = 0;
   for(int i = 0; i < n; i++) {
		int x; cin >> x;
		if(i == 0) {
			ans += x;
			mx = x;
			continue;
		}
		
		if(x > mx) {
			ans += x;
			mx = x;
		}
   }
   cout << ans;
   
    return 0;
}