#include "sphinx.h"
using namespace std;
vector<int> adj[303];
vector<int> ch;
void dfs(int v) {
ch[v] = 1;
for (int u : adj[v]) {
if (ch[u]) continue;
dfs(u);
}
}
int other(int N, int v, int u) {
int ret = 0;
ch = vector<int>(N, 0);
ch[v] = ch[u] = 1;
for (int i = 0; i < N; i++) {
if (ch[i]) continue;
dfs(i);
ret++;
}
return ret;
}
vector<int> find_colours(int N, vector<int> X, vector<int> Y) {
for (int i = 0; i < X.size(); i++) {
adj[X[i]].push_back(Y[i]);
adj[Y[i]].push_back(X[i]);
}
vector<int> C(N, 0);
for (int i = 0; i < N; i++) {
vector<int> E(N, N);
E[i] = -1;
int s = 0, e = N-1;
while (s < e) {
int m = (s+e)/2;
int p = s;
for (int j = 0; j < N; j++) {
if (i == j) continue;
E[j] = p;
if (p < m) p++;
}
int x = perform_experiment(E);
if (x == m-s+1) e = m;
else s = m+1;
}
C[i] = s;
}
return C;
}
# | 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... |