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;
using ll = int;
namespace{
vector<ll> a;
ll n;
}
void init(int k, std::vector<int> r) {
n = r.size();
a.resize(n+1,0);
for(ll i = 0;i<n;i++) a[i+1] = a[i]+(r[i]>r[(i+n-1)%n]);
}
int compare_plants(int x, int y) {
if (a[y]-a[x]==y-x) return -1;
if (a[y]-a[x]==0) return 1;
if (a[n]-a[y]+a[x]==0) return -1;
if (a[n]-a[y]+a[x]==n-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... |