#include "plants.h"
#include <stdio.h>
#include <vector>
#include <utility>
using namespace std;
pair < int , int > con[100005];
vector < int > all;
int N;
void init(int k,vector<int> r)
{
int a=0,b=0,i,j,ok=0;
all=r;
N=r.size();
for(i=0;ok==0;i++)
{
b=0;
if(r[(i+N-1)%N]!=r[i])
{
b=0;
a++;
for(j=i;r[j]==r[i];j=(j+1)%N)
{
if(j==N-1) ok=1;
con[j]=make_pair(a,b);
b++;
}
i=(j+N-1)%N;
}
}
return;
}
int compare_plants(int x, int y)
{
if(con[x].first==con[(y+N-1)%N].first)
{
if(all[x]==0) return -1;
return 1;
}
if(con[y].first==con[(x+N-1)%N].first)
{
if(all[y]==0) return 1;
return -1;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 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 |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |