# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1153779 | yhkhoo | Po (COCI21_po) | C++20 | 6 ms | 836 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define fi first
#define se second
int main(){
cin.tie(0); ios_base::sync_with_stdio(0);
int n;
cin >> n;
int a[n];
for(int i=0; i<n; i++){
cin >> a[i];
}
stack<int> en;
en.push(0);
int ans=0;
for(int i=0; i<n; i++){
while(a[i] < en.top()){
en.pop();
}
if(a[i] > en.top()){
en.push(a[i]);
ans++;
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |