#include "plants.h"
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
using namespace std;
vector<int>v;
int n;
void init(int k, std::vector<int> r) {
n = r.size();
v = r;
return;
}
bool check(int x,int y){
for(int i = x; i != y; i = (i+1)%n){
if(v[i] != 1){
return false;
}
}
return true;
}
bool check1(int x,int y){
for(int i = x; i != y; i = (i+1)%n){
if(v[i] != 0){
return false;
}
}
return true;
}
int compare_plants(int x, int y) {
if(check(y,x) || check1(x,y)) return 1;
if(check1(y,x) || check(x,y)) return -1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
72 ms |
3144 KB |
Output is correct |
7 |
Correct |
269 ms |
3448 KB |
Output is correct |
8 |
Correct |
135 ms |
4984 KB |
Output is correct |
9 |
Correct |
285 ms |
4984 KB |
Output is correct |
10 |
Correct |
1658 ms |
5112 KB |
Output is correct |
11 |
Execution timed out |
4078 ms |
5116 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
72 ms |
3144 KB |
Output is correct |
7 |
Correct |
269 ms |
3448 KB |
Output is correct |
8 |
Correct |
135 ms |
4984 KB |
Output is correct |
9 |
Correct |
285 ms |
4984 KB |
Output is correct |
10 |
Correct |
1658 ms |
5112 KB |
Output is correct |
11 |
Execution timed out |
4078 ms |
5116 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |