#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 |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
40 ms |
4048 KB |
Output is correct |
7 |
Correct |
46 ms |
5748 KB |
Output is correct |
8 |
Correct |
62 ms |
10188 KB |
Output is correct |
9 |
Correct |
60 ms |
10200 KB |
Output is correct |
10 |
Correct |
59 ms |
10188 KB |
Output is correct |
11 |
Correct |
61 ms |
10204 KB |
Output is correct |
12 |
Correct |
75 ms |
10204 KB |
Output is correct |
13 |
Correct |
61 ms |
10200 KB |
Output is correct |
14 |
Correct |
58 ms |
10184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
248 KB |
Output is correct |
4 |
Incorrect |
1 ms |
296 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
40 ms |
4048 KB |
Output is correct |
7 |
Correct |
46 ms |
5748 KB |
Output is correct |
8 |
Correct |
62 ms |
10188 KB |
Output is correct |
9 |
Correct |
60 ms |
10200 KB |
Output is correct |
10 |
Correct |
59 ms |
10188 KB |
Output is correct |
11 |
Correct |
61 ms |
10204 KB |
Output is correct |
12 |
Correct |
75 ms |
10204 KB |
Output is correct |
13 |
Correct |
61 ms |
10200 KB |
Output is correct |
14 |
Correct |
58 ms |
10184 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |