# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
475158 | Ahmed_Solyman | Po (COCI21_po) | C++14 | 46 ms | 1708 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |