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<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
const int N = 3e5+5;
const int MOD = 1e9+7;
const ll INF = 1e18+5;
#ifdef dremix
#define p2(x,y) cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<endl;
#define ppv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v.F<<"-"<<v.S<<", ";cerr<<"}"<<endl;
#else
#define p2(x,y) {}
#define ppv(x) {}
#endif
vector<pi> pref;
int n;
void init(int k, vector<int> R) {
n = R.size();
int i;
int prev = -1;
pref.resize(n*2);
int cnt = 0;
for(i=0;i<n*2;i++){
if(R[i%n] != prev){
cnt = 0;
prev = R[i%n];
}
cnt++;
pref[i] = {cnt,prev};
}
ppv(pref)
return;
}
int compare_plants(int x, int y) {
int ret = 0;
if(pref[x].F + y - x - 1 == pref[y-1].F){
if(pref[x].S == 0)ret = 1;
else ret = -1;
}
if(pref[y].F + x + n - 1 - y == pref[x+n-1].F){
if(pref[y].S == 0)ret = -1;
else ret = 1;
}
return ret;
}
# | 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... |