# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
768978 | 2023-06-29T03:56:34 Z | t6twotwo | Comparing Plants (IOI20_plants) | C++17 | 0 ms | 0 KB |
#include "plants.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int N, K; vector<int> R, pfs; void init(int k, std::vector<int> r) { K = k, R = r; N = H.size(); pfs.resize(N + 1); for (int i = 0; i < N; i++) { pfs[i + 1] = pfs[i] + R[i]; } } int compare_plants(int x, int y) { if (pfs[y] - pfs[x] == 0) { return 1; } if (pfs[y] - pfs[x] == y - x) { return -1; } if (pfs[N] - pfs[y] + pfs[x] == 0) { return -1; } if (pfs[N] - pfs[y] + pfs[x] == N - y + x) { return 1; } return 0; }