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;
const int maxn = 2e5 + 8;
int N,K;
int tmp[maxn],arr[maxn],indexing;
void init(int k, std::vector<int> r){
N = r.size();
K = k;
indexing = N;
for(int i=0;i<N;i++){
for(int j=0;j<N;j++){
if(r[j] == 0){
bool valid = true;
for(int k=1-K;k<0;k++){
if(r[(j+k+N)%N] == 0) valid = false;
}
if(valid){
for(int k=1-K;k<=0;k++){
r[(j+k+N)%N]--;
}
arr[j] = indexing--;
break;
}
}
}
}
}
int compare_plants(int x, int y){
if(arr[x] < arr[y]) return -1;
return 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... |