제출 #475158

#제출 시각아이디문제언어결과실행 시간메모리
475158Ahmed_SolymanPo (COCI21_po)C++14
20 / 70
46 ms1708 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n;cin>>n; vector<ll>arr(n); for(auto &i:arr)cin>>i; vector<ll>v; ll ans=0; for(ll i=0;i<n;i++){ while(v.size() && v[v.size()-1]>arr[i]){ v.pop_back(); } if(!v.size())ans++; else if(v[v.size()-1]<arr[i])ans++; v.push_back(arr[i]); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...