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 <bits/stdc++.h>
#include "plants.h"
#define sz(x) (int)x.size()
using namespace std;
int n;
vector<int> ord;
void init(int k, std::vector<int> r) {
n = sz(r);
ord.resize(n, -1);
for (int i = 0; i < n; i++) {
int mn = -1;
for (int j = 0; j < n; j++) if (!~ord[j]) {
if (!~mn || r[j] < r[mn]) mn = j;
}
ord[mn] = n - i;
for (int j = 1; j <= k-1; j++) {
int idx = mn - j;
if (idx < 0) idx += n;
r[idx]--;
}
}
}
int compare_plants(int x, int y) {
return ord[x] > ord[y] ? 1 : -1;
return 0;
}
# | 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... |