#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 4;
int n, pre[N];
void init(int k, std::vector<int> r) {
assert(k == 2);
n = r.size();
for (int i=1; i<=n; i++) pre[i] = pre[i-1] + r[i-1];
return;
}
int compare_plants(int x, int y) {
if (x==y) return 0;
if (x<y) {
int t = pre[y]-pre[x];
if (t == y-x) return 1;
else if (!t) return -1;
else return 0;
}
else {
int t = pre[x]-pre[y];
if (!t) return 1;
else if (t == x-y) return 1;
else 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... |