# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
898529 | vjudge1 | Po (COCI21_po) | C++17 | 36 ms | 1572 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() {
int n, ans = 0;
cin >> n;
stack<int> s;
for(int i = 0; i < n; i++) {
int x;
cin >> x;
while(s.size()&&s.top()>x)
s.pop();
if(s.size()&&s.top()==x)
continue;
if(x)
ans++,s.push(x);
}
cout << ans << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |