#include "plants.h"
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=100;
int r[N];
int n;
void init(int k, vector<int> R) {
n=R.size();
for(int i=0;i<n;i++)r[i]=R[i];
if(r[0]==0)r[0]=-1;
for(int i=1;i<n;i++)
{
r[i]+=r[i-1];
}
}
int compare_plants(int x, int y) {
int z=0;
if(x>0)z=r[x-1];
if(r[y]-z==y-x)return -1;
if(-r[y]+z==y-x)return 1;
if(z+r[n-1]-r[y-1]==x+1+n-1-y)return -1;
if(z+r[n-1]-r[y-1]==-x-1-n+1+y)return 1;
return 0;
}
/*
5 2 3
1 1 1 1 1
0 1 1 3 1 4
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |