#include "plants.h"
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int,int>P;
int n;
vector<P>xs;
void init(int k, std::vector<int> r){
n=r.size();
//k=2
vector<int>v(2*r.size());
rep(i,2*r.size()){
v[i]=r[i%r.size()];
}
rep(i,v.size()){
if(i==0||v[i-1]!=v[i]){
xs.push_back(P(i,v[i]));
}
}
xs.push_back(P(2*r.size(),0));
return;
}
int compare_plants(int x, int y) {
int id1=lower_bound(xs.begin(),xs.end(),P(x+1,0))-xs.begin()-1;
int id2=lower_bound(xs.begin(),xs.end(),P(y+1,0))-xs.begin()-1;
if(y<=xs[id1+1].first){
if(xs[id1].second==0)return 1;
else return -1;
}
if(x+n<=xs[id2+1].first){
if(xs[id2].second==0)return -1;
else return 1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
69 ms |
4024 KB |
Output is correct |
7 |
Correct |
89 ms |
5452 KB |
Output is correct |
8 |
Correct |
148 ms |
9364 KB |
Output is correct |
9 |
Correct |
125 ms |
8812 KB |
Output is correct |
10 |
Correct |
139 ms |
8684 KB |
Output is correct |
11 |
Correct |
114 ms |
8832 KB |
Output is correct |
12 |
Correct |
104 ms |
8684 KB |
Output is correct |
13 |
Correct |
94 ms |
8684 KB |
Output is correct |
14 |
Correct |
95 ms |
8684 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
268 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
69 ms |
4024 KB |
Output is correct |
7 |
Correct |
89 ms |
5452 KB |
Output is correct |
8 |
Correct |
148 ms |
9364 KB |
Output is correct |
9 |
Correct |
125 ms |
8812 KB |
Output is correct |
10 |
Correct |
139 ms |
8684 KB |
Output is correct |
11 |
Correct |
114 ms |
8832 KB |
Output is correct |
12 |
Correct |
104 ms |
8684 KB |
Output is correct |
13 |
Correct |
94 ms |
8684 KB |
Output is correct |
14 |
Correct |
95 ms |
8684 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |