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>
#define F first
#define S second
#define ll long long
#define nd '\n'
using namespace std;
vector <int> prefix;
ll n=0;
void init (int k, vector <int> r){
n = r.size();
prefix.assign(n,0);
prefix[0]=r[0];
for (ll i=1; i<n; i++){
prefix[i] = prefix[i-1] + r[i];
}
return;
}
int compare_plants(int x, int y){
ll c = prefix[y-1];
if (x != 0) c-=prefix[x-1];
if (c == y-x) return -1;
else if (c == 0) return 1;
c = prefix[n-1] - prefix[y-1];
c+= prefix[x-1];
if (c == n-y+x) return 1;
else if (c == 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... |