#include<bits/stdc++.h>
#define MAXN 200007
using namespace std;
int n,perm[MAXN],k,minpos,maxpos;
int pref[MAXN],sum;
void init(int K,vector<int> R){
n=int(R.size()); k=K;
for(int i=0;i<n;i++){
pref[i+1]=R[i];
pref[i+1]+=pref[i];
}
}
int compare_plants(int x, int y){
if(x>y)swap(x,y);
x++; y++;
if(pref[y-1]-pref[x-1]==0)return -1;
if(pref[y-1]-pref[x-1]==y-x)return 1;
if(sum-(pref[y-1]-pref[x-1])==0)return 1;
if(sum-(pref[y-1]-pref[x-1])==n-(y-x))return -1;
return 0;
}
/*
int main(){
init(4,{3,0,0,0,1,2});
}
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |