#include "sphinx.h"
#include <bits/stdc++.h>
using namespace std;
int n;
bool check(int x,int l,int r)
{
vector<int>temp(n);
int l1=l,k=0;
for(int i=0;i<n;i++)
{
if(i==x)temp[i]=-1;
else if(l<=r)
{
temp[i]=l;l++;
}
else {
temp[i]=n;k=1;
}
}
int a=perform_experiment(temp);
if(a==r-l1+1+k)return true;
else return false;
}
vector<int> find_colours(int N,vector<int> X,vector<int> Y) {
n=N;
vector<int>res(n);
for(int i=0;i<n;i++)
{
int l=0,r=n-1;
while(r>l)
{
int m=(l+r)/2;
if(check(i,m+1,r))l=m+1;
else r=m;
}
res[i]=l;
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |