Submission #988129

# Submission time Handle Problem Language Result Execution time Memory
988129 2024-05-24T05:54:53 Z vjudge1 Airline Route Map (JOI18_airline) C++17
Compilation error
0 ms 0 KB
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>adj[1012];
int means[1024],val[1012],DEG[1012],IN[1012];
void Bob( int V, int U, int C[], int D[] ){
	int CC=0;
	for(int i=3;i<1024;i++)
		if(__builtin_popcount(i)>1)
			means[i]=CC++;
	for(int i=0;i<U;i++)
		adj[C[i]].push_back(D[i]),
		adj[D[i]].push_back(C[i]);
	int cnt=0;
	int x,y,z,w;
	for(int i=0;i<V;i++)
		if(adj[i].size()<2)
			x=i;
	y=adj[x][0];
	for(auto j:adj[y])
		IN[j]=1;
	for(int i=0;i<V;i++)
		for(auto j:adj[i])
			DEG[i]+=IN[j];
	for(auto i:adj[y])
		if(DEG[i]==1)
			z=i;
	vector<int>v{z};
	for(int Q=6;Q--;)
		for(auto i:adj[z])
			if(IN[i]&&i-w){
				w=z,v.push_back(z=i);
				break;
			}
	for(auto i:adj[z])
		if(IN[i]&&i-w&&DEG[i]==2){
			w=z,v.push_back(z=i);
			break;
		}
	for(auto i:adj[z])
		if(IN[i]&&i-w){
			w=z,v.push_back(z=i);
			break;
		}
	for(auto i:adj[z])
		if(IN[i]&&i-w&&DEG[i]==2){
			w=z,v.push_back(z=i);
			break;
		}
	IN[y]=1;
	for(int i=0;i<10;i++)
		for(auto j:adj[v[i]])
			val[j]+=1<<i;
	vector<pair<int,int>>EEE;
	for(int i=0;i<U;i++) if(!IN[C[i]]&&!IN[D[i]])
		EEE.push_back({means[val[C[i]]],means[val[D[i]]]});
	InitMap(V-12,EEE.size());
	for(auto[i,j]:EEE)
		MakeMap(i,j);
}



    

Compilation message

Alice.cpp: In function 'void Bob(int, int, int*, int*)':
Alice.cpp:14:6: warning: unused variable 'cnt' [-Wunused-variable]
   14 |  int cnt=0;
      |      ^~~
Alice.cpp:31:12: warning: 'w' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |    if(IN[i]&&i-w){
      |       ~~~~~^~~~~
/usr/bin/ld: /tmp/cciq0PUf.o: in function `Bob(int, int, int*, int*)':
Alice.cpp:(.text+0x4f7): undefined reference to `InitMap(int, int)'
/usr/bin/ld: Alice.cpp:(.text+0x516): undefined reference to `MakeMap(int, int)'
/usr/bin/ld: /tmp/ccHQ0aqf.o: in function `main':
grader_alice.cpp:(.text.startup+0xa2): undefined reference to `Alice(int, int, int*, int*)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccaU2uJX.o: in function `main':
grader_bob.cpp:(.text.startup+0xb2): undefined reference to `Bob(int, int, int*, int*)'
collect2: error: ld returned 1 exit status