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