#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int N = 1e6+5;
int n;
queue<int> v[N];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
int mx = 0;
for(int i = 0; i < n; i++) {
int x;
cin >> x;
v[x].push(i);
mx = max(mx, x);
}
int c = 0;
for(int i = mx; i >= 1; i--) {
if(v[i].empty()) continue;
c++;
int now = i;
while(!v[now].empty()) {
v[now].pop();
now--;
}
}
cout << c << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
82 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Runtime error |
80 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
3 |
Runtime error |
83 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
4 |
Runtime error |
79 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
5 |
Runtime error |
78 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
6 |
Runtime error |
82 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
7 |
Runtime error |
81 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
8 |
Runtime error |
80 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
9 |
Runtime error |
74 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
10 |
Runtime error |
82 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |