# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
300474 | 2020-09-17T07:53:09 Z | Muhammetali | Comparing Plants (IOI20_plants) | C++11 | 0 ms | 0 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; int res[10001]; int n; void init(int k, std::vector<int> r) { n=sz(r); for (int i=0;i<sz(r);i++)res[i]=r[i]; return; } int compare_plants(int x, int y) { bool b=0; int k=res[x]; for (int i=x+1;i<y;i++) { if (res[i]!=k) { b=1; break; } } if (b==0) { if (k==0)return 1; else return -1; } b=0; k=res[y]; while(y!=x) { if (res[y]!=k) { b=1; break; } y++; if (y==n)y=0; } if (!b) { if (k==1)return 1; else return -1; } return 0; }