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"
#define ll long long
#define ff first
#define ss second
#define ln "\n"
using namespace std;
vector<int> cast;
void init(int k, std::vector<int> r) {
int n = (int)r.size();
cast.resize(n);
for (ll i=0; i<n; i++){
if (r[i]){
cast[(i+1)%n]=1;
}else{
cast[(i+1)%n]=-1;
}
}
for (ll i=1; i<n; i++) cast[i]+=cast[i-1];
if (cast[0]==-1){
for (ll i=0; i<n; i++) cast[i]++;
}
}
int compare_plants(int x, int y) {
if (cast[x]>cast[y]) return 1;
else if (cast[x]<cast[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... |