Submission #47041

# Submission time Handle Problem Language Result Execution time Memory
47041 2018-04-26T16:37:45 Z vanogam Airline Route Map (JOI18_airline) C++14
Compilation error
0 ms 0 KB
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
void Bob( int V, int U, int C[], int D[] ){
	vector<int> v[1102];
	int d[1102][1102],f[1102],g[1102];
	int k=0;
	for(int i=0;i<U;i++){
        //cout<<C[i]<<" "<<D[i]<<endl;
        v[C[i]].push_back(D[i]);
        v[D[i]].push_back(C[i]);
        d[C[i]][D[i]]=1;
        d[D[i]][C[i]]=1;
	}
    for(int i=0;i<V;i++){
        sort(v[i].begin(),v[i].end());
        //for(auto it:v[i]) cout<<i<<" "<<it<<endl;
    }
	for(int i=0;i<V;i++){
        if(v[i].size()==V-2) {k=i;break;}
	}
	f[k]=-10;
	g[k]=2;
	for(auto it:v[k]) g[it]=1;
	for(int i=0;i<V;i++){
        if(!g[i]) {k=i;break;}
	}g[k]=2;
	f[k]=-10;

	for(int i=0;i<V;i++){
        if(!d[k][i]) g[i]=2;
	}
	for(int i=0;i<V;i++){
        if(g[i]==2) continue;//cout<<"**"<<i<<"**";
        for(int a=i+1;a<V;a++){
            if(g[a]==2) continue;
            if(d[i][a]){f[i]--;f[a]--;}
        }
	}
	for(int i=0;i<V;i++){//cout<<f[i]<<"&";
        if(f[i]==-4) {k=i;break;}
	}
	int xr=1,l=0;
	for(int i=0;i<10;i++){
        for(auto it:v[k]){
            if(f[it]>=0) {f[it]+=xr;}
            if(f[it]==-10) continue;//cout<<f[it]<<" ";
            if(f[it]==-3 && f[k]!=-4) {l=it;}
            if(f[it]==-2) {l=it;}
        }//cout<<endl;
        f[k]=-10;//cout<<f[0]<<"**"<<endl;
        k=l;
        xr*=2;
	}

	for(int i=0;i<V;i++){
        if(f[i]>=0){
            for(auto it:v[i]){
                if(f[it]>=0) {d[i][it]=2;d[it][i]=2;}
            }
        }
	}
	int m=0;
	for(int i=0;i<V;i++){
        if(f[i]<0) continue;
        for(int a=i+1;a<V;a++){
            if(f[a]<0) continue;
            if(d[i][a]==2) m++;
        }
	}//cout<<"**"<<m<<"**";
	InitMap(V-12,m);
	for(int i=0;i<V;i++){
        if(f[i]<0) continue;
        for(int a=i+1;a<V;a++){
            if(f[a]<0) continue;
            if(d[i][a]==2){MakeMap(f[i],f[a]);}
        }
	}
}

#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
void Alice( int N, int M, int A[], int B[] ){
	int a=0,u=0;
	a+=N+10+10+M+12;
	for(int i=0;i<N;i++){
        a+=__builtin_popcount(i);
	}
	InitG( N+12, a );

	for(int i=0;i<N;i++){
        MakeG(u++,i,N+10);
        //MakeG(u++,i,N+11);//cout<<"*";
	}

	for(int i=N;i<N+10;i++){
        MakeG(u++,i,N+10);
        MakeG(u++,i,N+11);
       if(i!=N+9) MakeG(u++,i,i+1);
       //else MakeG(u++,N,i+2);
	}
	MakeG(u++,N,N+5);
	MakeG(u++,N,N+6);
	MakeG(u++,N,N+7);
	for(int i=0;i<M;i++) MakeG(u++,A[i],B[i]);
	for(int i=0;i<N;i++){
        for(int a=0;a<10;a++){
            if(i&(1<<a)) MakeG(u++,i,N+a);
        }
	}
}

Compilation message

Alice.cpp: In function 'void Bob(int, int, int*, int*)':
Alice.cpp:20:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(v[i].size()==V-2) {k=i;break;}
            ~~~~~~~~~~~^~~~~
/tmp/cc5qVpAC.o: In function `main':
grader_alice.cpp:(.text.startup+0xe0): undefined reference to `Alice(int, int, int*, int*)'
/tmp/ccPKf3dI.o: In function `Bob(int, int, int*, int*)':
Alice.cpp:(.text+0x7f5): undefined reference to `InitMap(int, int)'
Alice.cpp:(.text+0x86d): undefined reference to `MakeMap(int, int)'
collect2: error: ld returned 1 exit status

/tmp/cckNtlba.o: In function `main':
grader_bob.cpp:(.text.startup+0xd0): undefined reference to `Bob(int, int, int*, int*)'
/tmp/ccYzVq5k.o: In function `Alice(int, int, int*, int*)':
Bob.cpp:(.text+0x58): undefined reference to `InitG(int, int)'
Bob.cpp:(.text+0x6a): undefined reference to `MakeG(int, int, int)'
Bob.cpp:(.text+0xa0): undefined reference to `MakeG(int, int, int)'
Bob.cpp:(.text+0xb2): undefined reference to `MakeG(int, int, int)'
Bob.cpp:(.text+0xc9): undefined reference to `MakeG(int, int, int)'
Bob.cpp:(.text+0xeb): undefined reference to `MakeG(int, int, int)'
/tmp/ccYzVq5k.o:Bob.cpp:(.text+0xf8): more undefined references to `MakeG(int, int, int)' follow
/tmp/ccYzVq5k.o: In function `Alice(int, int, int*, int*)':
Bob.cpp:(.text+0x1b9): undefined reference to `InitG(int, int)'
collect2: error: ld returned 1 exit status