#include <bits/stdc++.h>
#include "plants.h"
using namespace std;
const int nax=4e5+5;
int mx[nax];
int mn[nax];
int n;
void init(int k, std::vector<int> r) {
n=r.size();
for (int i = 0; i < n*2; ++i)
{
mx[i]=i;
mn[i]=i;
}
for (int i = 0; i < n*2; ++i)
{
if(r[i%n]==0){
mn[i+1]=mn[i];
}else{
mx[i+1]=mx[i];
}
}
return;
}
int compare_plants(int x, int y) {
if(mx[y]<=x){
return -1;
}else if(mn[y]<=x){
return 1;
}else if(mx[x+n]<=y){
return 1;
}else if(mn[x+n]<=y){
return -1;
}else return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
25 ms |
5208 KB |
Output is correct |
7 |
Correct |
29 ms |
5468 KB |
Output is correct |
8 |
Correct |
46 ms |
7248 KB |
Output is correct |
9 |
Correct |
41 ms |
9024 KB |
Output is correct |
10 |
Correct |
72 ms |
9048 KB |
Output is correct |
11 |
Correct |
62 ms |
9268 KB |
Output is correct |
12 |
Correct |
57 ms |
9132 KB |
Output is correct |
13 |
Correct |
39 ms |
9040 KB |
Output is correct |
14 |
Correct |
42 ms |
9040 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2648 KB |
Output is correct |
2 |
Correct |
1 ms |
2392 KB |
Output is correct |
3 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2392 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Incorrect |
0 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
25 ms |
5208 KB |
Output is correct |
7 |
Correct |
29 ms |
5468 KB |
Output is correct |
8 |
Correct |
46 ms |
7248 KB |
Output is correct |
9 |
Correct |
41 ms |
9024 KB |
Output is correct |
10 |
Correct |
72 ms |
9048 KB |
Output is correct |
11 |
Correct |
62 ms |
9268 KB |
Output is correct |
12 |
Correct |
57 ms |
9132 KB |
Output is correct |
13 |
Correct |
39 ms |
9040 KB |
Output is correct |
14 |
Correct |
42 ms |
9040 KB |
Output is correct |
15 |
Correct |
1 ms |
2648 KB |
Output is correct |
16 |
Correct |
1 ms |
2392 KB |
Output is correct |
17 |
Incorrect |
0 ms |
2392 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |