# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
515959 |
2022-01-20T08:05:07 Z |
KoD |
Po (COCI21_po) |
C++17 |
|
9 ms |
720 KB |
#include <bits/stdc++.h>
using std::vector;
using std::array;
using std::pair;
using std::tuple;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int N;
std::cin >> N;
vector<int> val;
val.push_back(0);
int ans = 0;
while (N--) {
int x;
std::cin >> x;
while (val.back() > x) {
ans += 1;
val.pop_back();
}
if (val.back() != x) {
val.push_back(x);
}
}
ans += val.size() - 1;
std::cout << ans << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
308 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
4 ms |
332 KB |
Output is correct |
5 |
Correct |
5 ms |
332 KB |
Output is correct |
6 |
Correct |
9 ms |
720 KB |
Output is correct |
7 |
Correct |
9 ms |
332 KB |
Output is correct |