#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const int N = 200200;
int level[N];
void init(int k, vector<int> r) {
int n = r.size();
int ok = 0, last = -k, lev = n;
while (ok < n) {
for (int i = n - 1; i >= n - k; i--) {
if (!r[i]) {
last = i - n;
break;
}
}
for (int i = 0; i < n; i++) {
if (!r[i]) {
if (i - last >= k) {
level[i] = lev;
ok++;
for (int j = i - 1; j > i - k; j--) {
if (j >= 0) {
r[j]--;
} else {
r[j + n]--;
}
}
r[i] = INT32_MAX / 2;
}
last = i;
}
}
lev--;
}
}
int compare_plants(int x, int y) {
if (level[x] < level[y]) {
return -1;
}
return level[x] > level[y];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Execution timed out |
4038 ms |
600 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |