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>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
int h,n,arr[200001];
void init(int k,vi r)
{
h=k;
n=sz(r);
for (int i=0;i<n;i++)
{
arr[i]=r[i];
}
return;
}
int compare_plants(int x,int y)
{
if (arr[x]==0)
{
int g=h-2;
int f=x;
while(f<y && g>=0)
{
f++;g--;
if (arr[f]==0)g=h-2;
}
if (f==y)return 1;
}
else
{
int g=h-2;
int f=x;
while(f<y && g>=0)
{
f++;g--;
if (arr[f]==h-1)g=h-2;
}
if (f==y)return -1;
}
if (arr[y]==h-1)
{
int g=h-2;
int f=y;
while(f<n && g>=0)
{
f++;g--;
if (arr[f]==h-1)g=h-2;
}
if(f!=n)return 0;
f=0;
if (arr[f]==h-1)g=h-2;
while(f<x && g>=0)
{
f++;g--;
if (arr[f]==h-1)g=h-2;
}
if (f==x)return 1;
}
else
{
int g=h-2;
int f=y;
while(f<n && g>=0)
{
f++;g--;
if (arr[f]==0)g=h-2;
}
if (f!=n)return 0;
f=0;
if (arr[f]==h-1)g=h-2;
while(f<x && g>=0)
{
f++;g--;
if (arr[f]==0)g=h-2;
}
if (f==x)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... |