#include "plants.h"
#include<bits/stdc++.h>
#define lli long long int
using namespace std;
vector<int>l;
lli x,y;
void init(int k, std::vector<int> r) {
l=r;
x=r.size();
y=k;
}
int compare_plants(int a, int b) {
lli n;
int b1=1;
if(a>b){
swap(a,b);
b1*=-1;
}
if(a+x-b<b-a){
n=a+x-b;
swap(a,b);
b1*=-1;
}
else{
n=b-a;
}
if(n>y){
return 0;
}
else if(l[a]==0){
return 1*b1;
}
else if(l[a]==y){
return -1*b1;
}
else if(n<=abs(l[b]-l[a])&&l[b]-l[a]>0){
return 1*b1;
}
else if(n<=abs(l[b]-l[a])){
return -1*b1;
}
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... |