Submission #782687

#TimeUsernameProblemLanguageResultExecution timeMemory
7826871075508020060209tcPo (COCI21_po)C++14
20 / 70
29 ms2408 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define X first #define Y second int n; int ar[500005]; signed main(){ int ans=0; cin>>n; for(int i=1;i<=n;i++){ cin>>ar[i]; } stack<int>stk; for(int i=1;i<=n;i++){ while(stk.size()&&stk.top()>ar[i]){stk.pop();} if(stk.size()&&stk.top()==ar[i]){continue;} stk.push(ar[i]); ans++; } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...