# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
811194 | Tunglam07 | Po (COCI21_po) | C++17 | 41 ms | 1340 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;
int main()
{
stack<int> st;
long long n, cnt = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
int val;
cin >> val;
while(!st.empty() && st.top() > val)
{
st.pop();
}
if(!st.empty() && st.top() == val || !val)
{
continue;
}
st.push(val);
cnt++;
}
cout << cnt;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |