#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
vi ranking;
void init(int k, std::vector<int> r) {
int n = r.size();
ranking.resize(n);
for(int i = 0; i<n; i++){
int window = 0;
for(int l = 0;l<k; l++){
window+=(r[l]==0);
}
int j;
for(j = k; j<n+k; j++){
int pos = j%n;
if(r[pos]==0&&window==0) goto found;
window-=r[j-k]==0;
window+=(r[pos]==0);
}
found:
for(int l = 1; l<k; l++) r[(j-l+n)%n]--;
r[j%n]=INT_MAX;
ranking[j%n] = i;
}
}
int compare_plants(int x, int y) {
if(ranking[x]<ranking[y]) return 1;
return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |