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 pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
const int maxn = 4e5 + 5;
const int INF = 1e9;
#include "plants.h"
int a[maxn];
int n, k;
vector<int> r;
void init(int _k, std::vector<int> _r) {
r = _r, k = _k;
n = r.size();
for(auto x : _r) r.pb(x);
for(int i = 0; i < 2 * n; i++) a[i] = 1 - r[i] * 2;
for(int i = 1; i < 2 * n; i++) a[i] += a[i - 1];
}
int compare_plants(int x, int y) {\
int m = a[y - 1] - (x ? a[x - 1] : 0);
if(m == y - x) return 1;
if(m == x - y) return -1;
x += n;
m = a[x - 1] - a[y - 1];
if(m == x - y) return -1;
if(m == 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... |