#include "plants.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define all(a) (a.begin(), a.end())
#define sz(a) (int)a.size()
vector<int> r;
vector<int> pref;
int n;
void init(int k, std::vector<int> _r) {
	r=_r;
	n=sz(r);
	pref.resize(sz(r)*2);
	pref[0]=r[0];
	for (int i = 1; i < sz(r)*2; i++) pref[i]=pref[i-1]+r[i%n];
	return;
}
int compare_plants(int x, int y) {
	if(x>y) y+=n;
	int sm=pref[y-1];
	if(x>0) sm-=pref[x-1];
	if(sm==0) return 1;
	if(sm==y-x) return -1;
	
	if(y>=n) y-=n;
	if(y>x)x+=n;
	sm=pref[x-1];
	if(y>0) sm-=pref[y-1];
	if(sm==0) return -1;
	if(sm==x-y) 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... |