Submission #1153773

#TimeUsernameProblemLanguageResultExecution timeMemory
1153773yhkhooPo (COCI21_po)C++20
10 / 70
6 ms1288 KiB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;
#define fi first
#define se second

int main(){
    cin.tie(0); ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    stack<int> en;
    en.push(0);
    int ans=0;
    for(int i=0; i<n; i++){
        if(a[i] > en.top()){
            en.push(a[i]);
            ans++;
        }
        while(a[i] < en.top()){
            en.pop();
        }
    }
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...