# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810539 | 2023-08-06T10:56:57 Z | tlnk07 | Po (COCI21_po) | C++17 | 29 ms | 1456 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 8 ms | 316 KB | Output is correct |
5 | Correct | 10 ms | 492 KB | Output is correct |
6 | Correct | 29 ms | 1456 KB | Output is correct |
7 | Correct | 29 ms | 1260 KB | Output is correct |