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>
using namespace std;
vector<int> o, z;
#define lb(x, v) lower_bound(x.begin(), x.end(), v)
bool ok (int x, int y, vector<int> &b) {
if (x > y) {
return lb(b, x) == b.end() && lb(b, y) == b.begin();
}
return lb(b, x) == lb(b, y);
}
void init(int k, vector<int> r) {
int n = r.size();
for (int i = 0; i < n; ++i) {
(r[i] ? o : z).push_back(i);
}
}
int compare_plants(int x, int y) {
return ok(x, y, o) || ok(y, x, z) ? 1 : ok(x, y, z) || ok(y, x, o) ? -1 : 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... |