# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1137353 | rixiepixie | Po (COCI21_po) | C++20 | 6 ms | 1608 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
cin.tie(0);
ios_base::sync_with_stdio(false);
///
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
stack<ll> st;
ll ans = 0;
for (int i = 0; i < n; i++) {
while (!st.empty() && st.top() > a[i]) {
st.pop();
}
if (a[i] > 0 && (st.empty() || st.top() < a[i])) {
ans++;
st.push(a[i]);
}
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |