#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(1e3+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 |
Correct |
1 ms |
1004 KB |
Output is correct |
2 |
Correct |
2 ms |
1004 KB |
Output is correct |
3 |
Correct |
2 ms |
1004 KB |
Output is correct |
4 |
Correct |
2 ms |
1004 KB |
Output is correct |
5 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |
6 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |
7 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |
8 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |
9 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |
10 |
Runtime error |
3 ms |
1900 KB |
Execution killed with signal 11 |