#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[])
{
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;
mark[n_10] = 1;
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;
vector < int > bits, deg(10, 0);
for (int u : Adj[n_11])
bits.pb(u);
if ((int)bits.size() != 10)
{
MakeMap(2, 1);
InitMap(2, 1);
return ;
}
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)
{
if (n_0 == -1)
n_0 = i;
else if ((int)Adj[bits[n_0]].size() < (int)Adj[bits[i]].size())
n_0 = i;
}
if (n_0 == -1)
{
InitMap(2, 1);
InitMap(2, 1);
}
vector < int > rbits(10, -1);
rbits[0] = bits[n_0];
bits[n_0] = -1;
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;
}
return ;
mark = vector < bool > (V, 0);
mark[n_10] = mark[n_11] = 1;
for (int i = 0; i < 10; i++)
mark[rbits[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:14:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int i = 0; i < V; i++)
^~~
Bob.cpp:17:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
mark[n_10] = 1;
^~~~
Bob.cpp:25:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int u : Adj[n_11])
^~~
Bob.cpp:27:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
if ((int)bits.size() != 10)
^~
Bob.cpp:38:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for (int i = 0; i < 10; i++)
^~~
Bob.cpp:46:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
if (n_0 == -1)
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
6896 KB |
Wrong Answer [17] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
6896 KB |
Wrong Answer [17] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
695 ms |
30552 KB |
Wrong Answer [17] |
2 |
Halted |
0 ms |
0 KB |
- |