# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1153765 | siewjh | Po (COCI21_po) | C++20 | 6 ms | 580 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int nums; cin >> nums;
stack<int> st;
st.push(0);
int ans = 0;
for (int i = 0; i < nums; i++){
int x; cin >> x;
while (x < st.top()) st.pop();
if (x > st.top()){
ans++; st.push(x);
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |