#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int> a(n);
vector<bool> b(n,0);
for (int i = 0; i < n; i++) cin >> a[i];
int ans = 0;
for (int i = 0; i < n; i++) {
if (b[i]) continue;
b[i] = 1;
int h = a[i] - 1;
for (int j = i + 1; j < n; j++) {
if (a[j] == h) {
b[j] = 1;
h--;
}
}
ans++;
}
cout << ans << "\n";
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
3 |
Incorrect |
4 ms |
312 KB |
Output isn't correct |
4 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
5 |
Execution timed out |
2071 ms |
7060 KB |
Time limit exceeded |
6 |
Execution timed out |
2056 ms |
7312 KB |
Time limit exceeded |
7 |
Execution timed out |
2081 ms |
5964 KB |
Time limit exceeded |
8 |
Execution timed out |
2070 ms |
6008 KB |
Time limit exceeded |
9 |
Execution timed out |
2056 ms |
6556 KB |
Time limit exceeded |
10 |
Execution timed out |
2055 ms |
6560 KB |
Time limit exceeded |