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;
int K, N;
vector<int> ps;
void init(int k, vector<int> r)
{
K = k;
N = (int)r.size();
r.insert(r.end(), r.begin(), r.end());
ps = vector<int>(N*2|1);
for (int i = 0; i < 2*N; i++)
ps[i+1] = ps[i] + r[i];
}
int compare_plants(int x, int y)
{
if (ps[y] - ps[x] == 0 || ps[x+N] - ps[y] == N + x - y)
return 1;
if (ps[y] - ps[x] == y - x || ps[x+N] - ps[y] == 0)
return -1;
return 0;
}
#ifdef TEST
#include "grader.cpp"
#endif
# | 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... |