# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1153891 | zhehan | Po (COCI21_po) | C++20 | 23 ms | 808 KiB |
#include <bits/stdc++.h>
using namespace std;
signed main(){
int n , x, ans = 1;
cin>>n;
vector<int> arr(n, 0);
stack<int> monostack;
for (int i = 0; i < n; ++i){
cin>>arr[i];
}
monostack.push(0);
for(int i=1;i<n;++i){
while(!monostack.empty() && arr[i]<arr[monostack.top()]){
monostack.pop();
}
if(monostack.empty()||arr[i]>arr[monostack.top()]){
ans++;
}
monostack.push(i);
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |