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