This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#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 & (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);
}
#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
#include "Boblib.h"
static vpii edges;
bitset<1012> adjMat[1012];
vi adjList[1012];
int num[1012];
void Bob(int V,int U,int *C,int *D) {
int i,j;
int x,y;
for (i = 0; i < U; i++) adjMat[C[i]][D[i]] = adjMat[D[i]][C[i]] = 1;
for (i = 0; i < V; i++) {
if (adjMat[i].count() == V-2) break;
}
x = i;
for (i = 0; i < V; i++) {
if ((i != x) && !adjMat[x][i]) break;
}
y = i;
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;
}
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(V-12,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:75: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:68:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (adjMat[i].count() == V-2) break;
~~~~~~~~~~~~~~~~~~^~~~~~
Bob.cpp:79:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v.size(); i++) {
~~^~~~~~~~~~
Bob.cpp:80:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < v.size(); j++) {
~~^~~~~~~~~~
Bob.cpp:84:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v.size(); i++) {
~~^~~~~~~~~~
Bob.cpp:98:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < adjList[u].size(); j++) {
~~^~~~~~~~~~~~~~~~~~~
Bob.cpp:110:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v2.size(); i++) {
~~^~~~~~~~~~~
Bob.cpp:112:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < v.size(); j++) {
~~^~~~~~~~~~
Bob.cpp:117:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < v2.size(); i++) {
~~^~~~~~~~~~~
Bob.cpp:118:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = i+1; j < v2.size(); j++) {
~~^~~~~~~~~~~
Bob.cpp:123: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);
~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |