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 "plants.h"
#include <bits/stdc++.h>
#define rall(s) s.end(), s.begin()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define vt vector
#define s second
#define f first
#define nl '\n'
using ll = long long;
//using pii = pair<int, int>;
//using pll = pair<ll, ll>;
using namespace std;
const int N = 2e5 + 5;
int n, tl, tr, pr[N];
void init(int k, vt<int> r) {
n = sz(r);
tl = n, tr = -1;
for (int i = 0; i < n; i++) {
if (!r[i]) {
tl = i;
break;
}
}
for (int i = n - 1; i >= 0; i--) {
if (!r[i]) {
tr = i;
break;
}
}
for (int i = 0; i < n; i++) {
if (i) pr[i] = pr[i - 1];
pr[i] += r[i];
}
return;
}
int compare_plants(int x, int y) {
if (tr < y && x <= tl) return 1;
if (pr[y - 1] - (x ? pr[x - 1] : 0) == 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... |