# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429374 | JUANDI321 | Comparing Plants (IOI20_plants) | C++17 | 0 ms | 0 KiB |
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"
#inlcude <vector>
#inlcude <iostream>
using namespace std;
int l[200100];
int nn;
void init(int k, vector<int> r)
{
int n = r.size();
nn = n;
l[0] = 200100;
for(int i = 0; i<n; i++)
{
if(r[i] == 1)l[i+1] = l[i] + 1;
else l[i] - 1;
}
return;
}
int compare_plants(int x, int y)
{
if( y-x = l[y]-l[x])return 1;
if( y-x = -1 *(l[y]-l[x]))return -1;
if( nn-y + i = l[n]-l[y] + l[i])return 1;
if( nn-y + i = -1*(l[n]-l[y] + l[i]))return -1;
return 0;
}