#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
bool isMapEdge[2000][2000];
void addEdge( int u, int v ) {
isMapEdge[u][v] = isMapEdge[v][u] = true;
}
void Alice( int n, int m, int a[], int b[] ){
int V = n + 12;
for ( int i = 0; i < m; i++ )
addEdge( a[i], b[i] );
int iden = n + 10, special = n + 11;
for ( int u = 0; u < n + 9; u++ )
addEdge( iden, u );
for ( int u = n; u < n + 9; u++ )
addEdge( special, u );
for ( int u = n; u < n + 9; u++ )
addEdge( u, u + 1 );
for ( int u = 0; u < n; u++ ) {
for ( int b = 0; b < 10; b++ ) {
if ( (u >> b) & 1 )
addEdge( u, n + b );
}
}
int E = 0;
for ( int u = 0; u < V; u++ ) {
for ( int v = u + 1; v < V; v++ ) {
if ( isMapEdge[u][v] )
E++;
}
}
InitG( V, E );
int e = 0;
for ( int u = 0; u < V; u++ ) {
for ( int v = u + 1; v < V; v++ ) {
if ( isMapEdge[u][v] )
MakeG( e++, u, v );
}
}
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
bool isEdge[2000][2000], isNode[2000];
int bit[11], val[2000], vec[2000];
vector<int> bits;
void Bob( int V, int E, int a[], int b[] ){
int n = V - 12;
for ( int i = 0; i < E; i++ )
isEdge[a[i]][b[i]] = isEdge[b[i]][a[i]] = true;
int iden = -1, special = -1;
for ( int u = 0; u < V; u++ ) {
for ( int v = 0; v < V; v++ )
vec[u] += isEdge[u][v];
if ( vec[u] == V - 3 )
iden = u;
E -= vec[u];
}
for ( int u = 0; u < V; u++ ) {
if ( u == iden || isEdge[u][iden] )
continue;
if ( vec[u] == 10 )
special = u;
else
bit[9] = u;
}
for ( int u = 0; u < V; u++ )
isNode[u] = true;
isNode[special] = isNode[iden] = false;
for ( int u = 0; u < V; u++ ) {
if ( isEdge[special][u] ) {
bits.push_back( u );
isNode[u] = false;
}
}
for ( int b = 9; b >= 1; b-- ) {
for ( int c: bits ) {
if ( isEdge[bit[b]][c] && c != bit[b + 1] )
bit[b - 1] = c;
}
}
for ( int u = 0; u < V; u++ ) {
if ( !isNode[u] )
continue;
val[u] = 0;
for ( int b = 0; b < 10; b++ )
val[u] += (isEdge[u][bit[b]] << b);
}
int m = 0;
for ( int u = 0; u < V; u++ ) {
for ( int v = u + 1; v < V; v++ ) {
if ( isNode[u] && isNode[v] && isEdge[u][v] )
m++;
}
}
InitMap( n, m );
for ( int u = 0; u < V; u++ ) {
for ( int v = u + 1; v < V; v++ ) {
if ( isNode[u] && isNode[v] && isEdge[u][v] )
MakeMap( val[u], val[v] );
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4744 KB |
Wrong Answer [12] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4744 KB |
Wrong Answer [12] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
350 ms |
20584 KB |
Wrong Answer [11] |
2 |
Halted |
0 ms |
0 KB |
- |