Submission #301555

#TimeUsernameProblemLanguageResultExecution timeMemory
301555MuhammetaliComparing Plants (IOI20_plants)C++11
0 / 100
386 ms3248 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...