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 "Alicelib.h"
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;
vector<pair<int, int> > Edge;
void Alice(int N, int M, int A[], int B[] ){
for(int i=0; i<M; i++){
Edge.push_back(make_pair(A[i], B[i]));
}
int two = 1;
for(int i=0; i<10; i++){
for(int j=0; j<N; j++){
if((j&two)!=0){
Edge.push_back(make_pair(j, i+N));
}
}
two*=2;
}
for(int i=0; i<N; i++){
Edge.push_back(make_pair(N+10, i));
Edge.push_back(make_pair(N+11, i));
}
for(int i=0; i<9; i++){
Edge.push_back(make_pair(N+i, N+10));
Edge.push_back(make_pair(N+i, N+i+1));
}
InitG(N+12, Edge.size());
for(int i=0; i<Edge.size(); i++){
MakeG(i, Edge[i].first, Edge[i].second);
}
return;
}
#include "Boblib.h"
#include <cassert>
#include <cstdio>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
#define MAX_V 1012
vector<int> gp[MAX_V+1];
bool chk[MAX_V+1];
int index[MAX_V+1];
bool vst[MAX_V+1];
bool f[MAX_V+1];
vector<pair<int, int> > edge;
void Bob( int V, int U, int C[], int D[] ){
for(int i=0; i<U; i++){
gp[C[i]].push_back(D[i]);
gp[D[i]].push_back(C[i]);
}
int idx = 0;
for(int i=1; i<V; i++){
if(gp[i].size()>gp[idx].size()){
idx = i;
}
}
for(int i=0; i<gp[idx].size(); i++){
vst[gp[idx][i]] = true;
}
int a = 0, b = 0;
for(int i=0; i<V; i++){
if(i==idx) continue;
if(vst[i]==false){
if(a==0) a = i;
else b = i;
}
}
if(gp[a].size()>gp[b].size()){int tmp = a; a = b; b = tmp;}
for(int i=0; i<V; i++){
chk[i] = true;
}
chk[idx] = false; chk[b] = false;
for(int i=0; i<gp[b].size(); i++){
chk[gp[b][i]] = false;
}
int two = (1<<9);
for(int T=0; T<10; T++){
int nxt = 0;
for(int i=0; i<gp[a].size(); i++){
if(chk[gp[a][i]]){
if(!f[gp[a][i]]){
nxt = gp[a][i];
}
continue;
}
index[gp[a][i]]+=two;
}
f[a] = true;
a = nxt;
two/=2;
}
chk[idx] = true; chk[b] = true;
for(int i=0; i<U; i++){
if(chk[D[i]] || chk[C[i]]) continue;
edge.push_back(make_pair(index[D[i]], index[C[i]]));
}
InitMap(V-12, edge.size());
for(int i=0; i<edge.size(); i++){
MakeMap(edge[i].first, edge[i].second);
}
return;
}
Compilation message (stderr)
Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:35:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<Edge.size(); i++){
~^~~~~~~~~~~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:32:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<gp[idx].size(); i++){
~^~~~~~~~~~~~~~~
Bob.cpp:48:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<gp[b].size(); i++){
~^~~~~~~~~~~~~
Bob.cpp:54:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<gp[a].size(); i++){
~^~~~~~~~~~~~~
Bob.cpp:73:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<edge.size(); i++){
~^~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |