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"
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define sz(a) (int)a.size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
const ll inf=1e18;
const int mod=1e9+7;
const int maxn=2e5+5;
int n,del;
int p[maxn];
void init(int k, vector<int>r){
n = sz(r);
p[0] = r[0];
for(int i = 1;i < n;i++) p[i] = p[i-1] + r[i];
}
int compare_plants(int x,int y){
if(x==0) del = 0;
else del = p[x-1];
if(p[y-1] - del == 0) return 1;
if(p[y-1] - del == y - x) return -1;
int sum = p[n-1] - p[y-1] + del;
if(sum == 0) return -1;
if(sum == (n - y) + 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... |