This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "bits/stdc++.h"
#include "plants.h"
#define MAXN 200005
using namespace std;
int pref[MAXN];
int n;
void init(int k, vector<int> r) {
n = r.size();
pref[0] = r[0];
for (int i = 1; i < n; i++)
pref[i] = pref[i-1] + r[i];
return;
}
int compare_plants(int x, int y) {
if (x == 0) {
if (pref[y-1] == 0) return 1;
if (pref[y-1] == y) return -1;
if (pref[n-1] - pref[y-1] == n-y) return 1;
if (pref[n-1] - pref[y-1] == 0) return -1;
} else {
if (pref[y-1] - pref[x-1] == 0) return 1;
if (pref[y-1] - pref[x-1] == y-x) return -1;
if (pref[n-1] - pref[y-1] == n-y && pref[x-1] == x) return 1;
if (pref[n-1] - pref[y-1] == 0 && pref[x-1] == 0) return -1;
}
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... |