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>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define F first
#define S second
ll INF = 1000000000;
const int N = 200001;
vi r, sum;
int n, k;
void init(int K, vi R) {
n = R.size();
r.resize(n); sum.resize(n+1);
FOR(i, 0, n) r[i] = R[i];
k = K;
FOR(i, 1, n+1){
sum[i] = sum[i-1] + r[i-1];
}
}
int compare_plants(int x, int y) {
if (sum[y] - sum[x] == 0 || sum[x] + sum[n] - sum[y] == n + x - y) return 1;
if (sum[y] - sum[x] == y - x || sum[x] + sum[n] - sum[y] == 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... |