# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
372996 |
2021-03-03T00:03:22 Z |
sam571128 |
Po (COCI21_po) |
C++14 |
|
15 ms |
1536 KB |
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
signed main(){
fastio
int n;
cin >> n;
int arr[n];
stack<int> s;
int ans = 0;
for(auto &x : arr){
cin >> x;
while(!s.empty()&&s.top()>x){
s.pop();
}
if(x==0) continue;
if(s.empty()||s.top()!=x){
ans++;
s.push(x);
}
}
cout << ans << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
6 ms |
876 KB |
Output is correct |
5 |
Correct |
7 ms |
876 KB |
Output is correct |
6 |
Correct |
13 ms |
1536 KB |
Output is correct |
7 |
Correct |
15 ms |
1280 KB |
Output is correct |