# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
580846 | joelau | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 340 KiB |
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;
int N,ans[200005];
vector<int> tmp;
void init(int k, vector<int> r) {
N = r.size();
for (int i = 0; i < N; ++i) {
tmp.clear();
for (int j = 0; j < N; ++j) if (r[j] == 0) tmp.push_back(j);
int n = tmp[0];
for (int j = 1; j < tmp.size(); ++j) if (tmp[j]-tmp[j-1] >= k) n = tmp[j];
ans[n] = N-i;
tmp[n] = 2e9;
for (int j = 1; j < k; ++j) tmp[(n-j+N)%N]--;
}
}
int compare_plants(int x, int y) {
return ans[x] > ans[y] ? 1 : -1;
}
Compilation message (stderr)
# | 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... |