Submission #1312835

#TimeUsernameProblemLanguageResultExecution timeMemory
1312835aaaaaaaaPo (COCI21_po)C++20
20 / 70
10 ms956 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    int n, ans = 0;
    cin >> n;
    vector<int> st;
    for(int i = 1, x; i <= n; ++i){
        cin >> x;
        while(st.size() && st.back() > x) st.pop_back();
        if(st.empty() || st.back() < x) ans += 1;
        st.push_back(x);
    }
    cout << ans << "\n";
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...