# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345477 | 2021-01-07T11:55:38 Z | maskoff | Comparing Plants (IOI20_plants) | C++14 | 0 ms | 0 KB |
#include "plants.h" using namespace std; int k; vector<int> r; void init(int k, vector<int> v) { r = v; k = K; return; } int compare_plants(int x, int y) { int mx = 0, mn = 1; for (int i = x; i < y; ++i) { mn = min(mn, r[i]); mx = max(mx, r[i]); } if (mn == mx) { if (mn == 0) { return -1; } else { return 1; } } return 0; }