#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n, h, t = 0;
vector<stack<int>> vs(1e6+2, stack<int>());
cin >> n;
while (n--) {
cin >> h;
if (vs[h+1].empty())
t++;
else
vs[h+1].pop();
vs[h].push(h);
}
cout << t << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
87 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Runtime error |
78 ms |
131076 KB |
Execution killed with signal 9 |
3 |
Runtime error |
78 ms |
131076 KB |
Execution killed with signal 9 |
4 |
Runtime error |
76 ms |
131076 KB |
Execution killed with signal 9 |
5 |
Runtime error |
81 ms |
131076 KB |
Execution killed with signal 9 |
6 |
Runtime error |
89 ms |
131076 KB |
Execution killed with signal 9 |
7 |
Runtime error |
77 ms |
131076 KB |
Execution killed with signal 9 |
8 |
Runtime error |
77 ms |
131076 KB |
Execution killed with signal 9 |
9 |
Runtime error |
76 ms |
131076 KB |
Execution killed with signal 9 |
10 |
Runtime error |
91 ms |
131076 KB |
Execution killed with signal 9 |