이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |