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;
#define what_is(a) cout << #a  << " is " << a << "\n"
int n;
int pref[200000];
void init(int k, std::vector<int> r) {
	n = r.size();
	pref[0]=r[0];
	for(int i=1;i<n;i++)pref[i]=r[i]+pref[i-1];
	return;
}
int getR(int l,int r){
	return pref[r]-(l==0?0:pref[l-1]);
}
int compare_plants(int x, int y) {
	int b = 1;
	if(x>y){
		swap(x,y);
		b=-1;
	}
	int one=getR(x,y-1),zero=y-x-getR(x,y-1);
	//what_is(one);
	//what_is(zero);
	if(zero==0)return -1*b;
	else if(one==0)return 1*b;
	one = getR(y,n-1)+getR(0,x-1),zero=n-y+x-getR(y,n-1)-getR(0,x-1);
	//what_is(one);
	//what_is(zero);
	if(zero==0)return 1*b;
	else if(one==0)return -1*b;
	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... |