This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#include "Alicelib.h"
static vpii edges;
void Alice(int N,int M,int *A,int *B) {
int i,j;
for (i = 0; i < M; i++) edges.pb(mp(A[i],B[i]));
for (i = 0; i < N+11; i++) {
if (i != N) edges.pb(mp(N,i));
}
for (i = 0; i < 10; i++) edges.pb(mp(N+i+1,N+11));
for (i = 1; i < 10; i++) edges.pb(mp(N+i,N+i+1));
edges.pb(mp(N+2,N+4));
for (i = 0; i < N; i++) {
for (j = 0; j < 10; j++) {
if ((i+7) & (1 << j)) edges.pb(mp(i,N+j+1));
}
}
InitG(N+12,edges.size());
for (i = 0; i < edges.size(); i++) MakeG(i,edges[i].first,edges[i].second);
}
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#include "Boblib.h"
static vpii edges;
bitset<1012> adjMat[1012];
vi adjList[1012];
int c[1012],num[1012];
void Bob(int V,int U,int *C,int *D) {
int i,j;
int x,y;
int N = V-12;
for (i = 0; i < U; i++) adjMat[C[i]][D[i]] = adjMat[D[i]][C[i]] = 1;
for (i = 0; i < V; i++) c[i] = adjMat[i].count();
for (i = 0; i < V; i++) {
for (j = 0; j < V; j++) {
if ((c[i] == V-2) && !adjMat[i][j] && (c[j] == 10)) {
x = i,y = j;
break;
}
}
if (j < V) break;
}
vi v,v2;
for (i = 0; i < V; i++) {
if (adjMat[y][i]) v.pb(i);
}
for (i = 0; i < v.size(); i++) {
for (j = 0; j < v.size(); j++) {
if (adjMat[v[i]][v[j]]) adjList[v[i]].pb(v[j]);
}
}
for (i = 0; i < v.size(); i++) {
if ((adjList[v[i]].size() == 1) && (adjList[adjList[v[i]][0]].size() == 3)) break;
}
int u = v[i];
fill(num,num+V,-1);
num[u] = 0;
for (i = 1; i < 10; i++) {
if (i == 1) u = adjList[u][0];
else if (i == 2) {
if (adjList[adjList[u][0]].size() == 2) u = adjList[u][0];
else if (adjList[adjList[u][1]].size() == 2) u = adjList[u][1];
else u = adjList[u][2];
}
else {
for (j = 0; j < adjList[u].size(); j++) {
if (num[adjList[u][j]] == -1) {
u = adjList[u][j];
break;
}
}
}
num[u] = i;
}
for (i = 0; i < V; i++) {
if (adjMat[x][i] && !adjMat[y][i]) v2.pb(i);
}
for (i = 0; i < v2.size(); i++) {
int n = 0;
for (j = 0; j < v.size(); j++) {
if (adjMat[v2[i]][v[j]]) n |= (1 << num[v[j]]);
}
num[v2[i]] = n-7;
}
for (i = 0; i < v2.size(); i++) {
for (j = i+1; j < v2.size(); j++) {
if (adjMat[v2[i]][v2[j]]) edges.pb(mp(num[v2[i]],num[v2[j]]));
}
}
InitMap(N,edges.size());
for (i = 0; i < edges.size(); i++) MakeMap(edges[i].first,edges[i].second);
}
Compilation message (stderr)
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:27:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < edges.size(); i++) MakeG(i,edges[i].first,edges[i].second);
~~^~~~~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v.size(); i++) {
~~^~~~~~~~~~
Bob.cpp:35:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < v.size(); j++) {
~~^~~~~~~~~~
Bob.cpp:39:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v.size(); i++) {
~~^~~~~~~~~~
Bob.cpp:53:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < adjList[u].size(); j++) {
~~^~~~~~~~~~~~~~~~~~~
Bob.cpp:65:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v2.size(); i++) {
~~^~~~~~~~~~~
Bob.cpp:67:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < v.size(); j++) {
~~^~~~~~~~~~
Bob.cpp:72:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v2.size(); i++) {
~~^~~~~~~~~~~
Bob.cpp:73:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = i+1; j < v2.size(); j++) {
~~^~~~~~~~~~~
Bob.cpp:78:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < edges.size(); i++) MakeMap(edges[i].first,edges[i].second);
~~^~~~~~~~~~~~~~
Bob.cpp:17:11: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
int x,y;
^
Bob.cpp:17:9: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
int x,y;
^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |