This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> h; // recovered
void init(int k, vector<int> r) {
int n = r.size();
h.resize(n, 0);
for (int it = 0; it < n; it++) {
int m = -1;
int l = -1;
for (int i = 0; i < n; i++) {
if (r[i] == 0) {
if (m == -1)
m = i;
else if (i - l > k)
m = i;
l = i;
}
}
// printf("DBG %d\n", m);
h[m] = n - it;
for (int i = 0; i < k; i++) {
r[(m + n - i) % n]--;
}
}
}
int compare_plants(int x, int y) { return h[x] > h[y] ? 1 : -1; }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |