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>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> plant;
void init(int k, vector<int> r){
int N = SZ(r);
plant.resize(N);
for(int p = N-1; p >= 0; p--){
for(int i = 0; i < N; i++){
if(r[i] == 0){
int id = i;
for(i = i + k; ; i++){
if(r[i % N] == 0){
id = i % N;
break;
}
}
plant[id] = p;
r[id] = -1;
for(int i = id - 1; i >= id - (k - 1); i--){
r[(i + N) % N]--;
}
}
}
}
}
int compare_plants(int x, int y) {
if(plant[x] > plant[y])
return 1;
else if(plant[x] < plant[y])
return -1;
else
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... |