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 <iostream>
#include <vector>
using namespace std;
int K, N;
vector<int> R, pref;
void init(int k, vector<int> r){
K = k;
R = r;
N = (int)r.size();
pref = vector<int>(N+1, 0);
for(int i=1; i<=N; i++) pref[i] = pref[i-1] + r[i-1];
}
int compare_plants(int x, int y){
int sum = pref[y] - pref[x+1];
if(x == 0 && sum == 0) return 1;
if(x == 1 && sum == y-x-1) return -1;
sum = pref[N] - pref[y+1] + pref[x];
if(y == 0 && sum == 0) return -1;
if(y == 1 && sum == N-(y+1) + x) 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... |