Submission #371045

#TimeUsernameProblemLanguageResultExecution timeMemory
371045nekiPo (COCI21_po)C++14
70 / 70
46 ms1764 KiB
#include <bits/stdc++.h>
#define ll long long
#define loop(i, a, b) for(ll i=a;i<b;i++)
#define pool(i, a, b) for(ll i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 500100
#define par pair<ll, ll>
#define ld long double
#define mod 1000000007
 

 
int main() {
    ll n, ans=0;cin >> n;
    vc<ll> st;st.ps(0);
    loop(i, 0, n){
        ll t;cin >> t;
        while(st.back()>t) st.pop_back();
        if(st.back()== t) ans+=0;
        else ans++, st.ps(t);
    }
    cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...