#include<bits/stdc++.h>
#include "Alicelib.h"
#define pb push_back
using namespace std;
void Alice(int N, int M, int A[], int B[])
{
vector < pair < int , int > > E;
for (int i = 0; i < M; i++)
E.pb({A[i], B[i]});
for (int i = 0; i < N; i++)
for (int j = 0; j < 10; j++)
if ((i >> j) & 1)
E.pb({i, N + j});
for (int j = 0; j < 9; j++)
E.pb({N + j, N + j + 1});
for (int i = 0; i < N + 10; i++)
E.pb({i, N + 10});
for (int j = 0; j < 10; j++)
E.pb({N + 11, N + j});
InitG(N + 12, (int)E.size());
for (int i = 0; i < (int)E.size(); i++)
MakeG(i, E[i].first, E[i].second);
return ;
}
#include<bits/stdc++.h>
#include "Boblib.h"
#define pb push_back
using namespace std;
void Bob(int V, int U, int C[], int D[])
{
InitMap(2, 1);
InitMap(2, 1);
return ;
int n_10 = -1;
vector < bool > mark(V, 0);
vector < vector < int > > Adj(V);
vector < vector < bool > > is(V, vector < bool > (V, 0));
for (int i = 0; i < U; i++)
{
Adj[C[i]].pb(D[i]), Adj[D[i]].pb(C[i]);
is[C[i]][D[i]] = is[D[i]][C[i]] = 1;
}
for (int i = 0; i < V; i++)
if ((int)Adj[i].size() == V - 2)
n_10 = i;
if (n_10 == -1)
{
InitMap(2, 1);
InitMap(2, 1);
return ;
}
for (int u : Adj[n_10])
mark[u] = 1;
int n_11 = -1;
for (int i = 0; i < V; i++)
if (!mark[i])
n_11 = i;
if (n_11 == -1)
{
MakeMap(2, 1);
InitMap(2, 1);
return ;
}
vector < int > bits(10, -1), deg(10, 0);
for (int u : Adj[n_11])
bits.pb(u);
for (int i = 0; i < 10; i++)
for (int j = i + 1; j < 10; j++)
if (is[bits[i]][bits[j]])
deg[i] ++, deg[j] ++;
int n_0 = -1;
for (int i = 0; i < 10; i++)
if (deg[i] == 1 && (n_0 == -1 || Adj[n_0].size() > Adj[bits[i]].size()))
n_0 = i;
vector < int > rbits(10, -1);
rbits[0] = n_0;
for (int i = 1; i < 10; i++)
{
int nxt = -1;
for (int j = 0; j < 10; j++)
if (bits[j] != -1 && is[rbits[i - 1]][bits[j]])
nxt = j;
rbits[i] = bits[nxt];
bits[nxt] = -1;
}
mark = vector < bool > (V, 0);
mark[n_10] = mark[n_11] = 1;
for (int i = 0; i < 10; i++)
mark[bits[i]] = 1;
vector < int > P(V, -1);
for (int i = 0; i < V; i++)
if (!mark[i])
{
int v = 0;
for (int j = 0; j < 10; j++)
if (is[i][rbits[j]])
v += (1 << j);
P[i] = v;
}
vector < pair < int , int > > E;
for (int i = 0; i < U; i++)
if (!mark[C[i]] && !mark[D[i]])
E.pb({P[C[i]], P[D[i]]});
InitMap(V - 12, (int)E.size());
for (int i = 0; i < (int)E.size(); i++)
MakeMap(E[i].first, E[i].second);
}
Compilation message
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:19:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int i = 0; i < V; i++)
^~~
Bob.cpp:22:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
if (n_10 == -1)
^~
Bob.cpp:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int i = 0; i < V; i++)
^~~
Bob.cpp:34:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
if (n_11 == -1)
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
6648 KB |
Wrong Answer [10] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
6648 KB |
Wrong Answer [10] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
666 ms |
30648 KB |
Wrong Answer [10] |
2 |
Halted |
0 ms |
0 KB |
- |