#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
int n,k;
vector<int>r,pre;
int get(int x,int y){
if(x>y) return 0;
return pre[y]-(x>0?pre[x-1]:0);
}
void init(int K,vector<int>R){
k=K;
r=R;
n=r.size();
pre.resize(n);
pre[0]=r[0];
for(int i=1;i<n;i++){
pre[i]=pre[i-1]+r[i];
}
}
int compare_plants(int x,int y){
if(get(x,y-1)==0) return 1;
if(get(y,n-1)==n-y&&get(0,x-1)==x) return 1;
if(get(x,y-1)==y-x) return -1;
if(get(y,n-1)==0&&get(0,x-1)==0) return -1;
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... |