# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
898529 |
2024-01-04T20:43:14 Z |
vjudge1 |
Po (COCI21_po) |
C++17 |
|
36 ms |
1572 KB |
#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 |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
428 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
7 ms |
604 KB |
Output is correct |
5 |
Correct |
10 ms |
600 KB |
Output is correct |
6 |
Correct |
30 ms |
1572 KB |
Output is correct |
7 |
Correct |
36 ms |
1300 KB |
Output is correct |