#include "plants.h"
#include <vector>
using namespace std;
vector<int> range;
void init(int k, vector<int> r)
{
int n = r.size();
range.resize(n, -1);
int i = 0;
while(i < n && range[i] < 0)
{
int cur = i;
while(i < n && r[i] > 0) i ++;
if(i == n)
{
i = 0;
while(r[i] > 0) i ++;
}
for(int j = cur; j != i; j = (j + 1) % n) range[j] = i;
i ++;
}
return;
}
int compare_plants(int x, int y)
{
int fac = 1;
if(x > y)
{
swap(x, y);
fac = -1;
}
int ans = 0;
if(range[x] > y || range[x] < x) ans = -1;
else if(range[y] > x) ans = 1;
return fac * ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |