#include <bits/stdc++.h>
#include "plants.h"
using namespace std;
typedef long long ll;
vector<int> a;
void init(int k, vector<int> r) {
ll n = r.size();
a = vector<int>(n);
for (int i = 0; i < n; i++) a[i] = r[i];
}
int compare_plants(int x, int y) {
ll n = a.size();
ll dir = a[x];
for (int i = x; i != y; i++) {
if (dir != a[i]) break;
if (i == y-1) {
return dir == 1 ? -1 : 1;
}
}
dir = a[y];
for (int i = y; i != x; i = (i+1)%n) {
if (dir != a[i]) break;
if (i == (x-1+n)%n) {
return dir == 0 ? -1 : 1;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
32 ms |
3816 KB |
Output is correct |
7 |
Correct |
84 ms |
4652 KB |
Output is correct |
8 |
Correct |
52 ms |
8020 KB |
Output is correct |
9 |
Correct |
84 ms |
8016 KB |
Output is correct |
10 |
Correct |
414 ms |
8028 KB |
Output is correct |
11 |
Execution timed out |
4027 ms |
8016 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
600 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
32 ms |
3816 KB |
Output is correct |
7 |
Correct |
84 ms |
4652 KB |
Output is correct |
8 |
Correct |
52 ms |
8020 KB |
Output is correct |
9 |
Correct |
84 ms |
8016 KB |
Output is correct |
10 |
Correct |
414 ms |
8028 KB |
Output is correct |
11 |
Execution timed out |
4027 ms |
8016 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |