Submission #101069

# Submission time Handle Problem Language Result Execution time Memory
101069 2019-03-16T10:34:02 Z TAISA_ Airline Route Map (JOI18_airline) C++14
0 / 100
759 ms 25636 KB
#include <bits/stdc++.h>
#include "Alicelib.h"
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll MOD=1000000007LL;
const ll INF=(1<<30);
const ll LINF=(1LL<<60);
template<typename T> void chmax(T &a,T b){a=max(a,b);}
template<typename T> void chmin(T &a,T b){a=min(a,b);} 
void Alice(int N,int M,int A[],int B[]){
	int n=N+12,m=M;
	vector<P> v;
	for(int i=0;i<N;i++){
		for(int j=0;j<10;j++){
			if((i>>j)&1){
				v.emplace_back(i,N+j);
			}
		}
		v.emplace_back(i,N+10);
	}
	for(int i=0;i<10;i++){
		v.emplace_back(N+i,N+10);
		v.emplace_back(N+i,N+11);
	}
	m+=v.size();
	InitG(n,m);
	for(int i=0;i<M;i++){
		MakeG(i,A[i],B[i]);
	}
	int c=M;
	for(auto p:v){
		MakeG(c,p.first,p.second);
		c++;
	}
}
#include<bits/stdc++.h>
#include "Boblib.h"
#define all(vec) vec.begin(),vec.end()
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll MOD=1000000007LL;
const ll INF=(1<<30);
const ll LINF=(1LL<<60);
template<typename T> void chmax(T &a,T b){a=max(a,b);}
template<typename T> void chmin(T &a,T b){a=min(a,b);} 
void Bob(int V,int U,int C[],int D[]){
	int n=V,m=U;
	vector<vector<int>> G(n);
	for(int i=0;i<m;i++){
		G[C[i]].push_back(D[i]);
		G[D[i]].push_back(C[i]);
	}
	int a,b;
	for(int i=0;i<n;i++){
		if(G[i].size()==n-2){
			a=i;
			break;
		}
	}
	vector<int> vis(n),idx(n);
	for(auto e:G[a])vis[e]=1;
	for(int i=0;i<n;i++){
		if(vis[i]==0&&a!=i){
			b=i;
			break;
		}
	}
	vis.assign(n,0);
	vector<P> v;
	for(auto e:G[b]){
		v.push_back(P(G[e].size(),e));
		vis[e]=1;
	}
	vis[a]=1,vis[b]=1;
	sort(all(v));
	reverse(all(v));
	for(int i=0;i<10;i++){
		int id=v[i].second;
		for(auto e:G[id]){
			idx[e]|=(1<<i);
		}
	}
	v.clear();
	for(int i=0;i<n;i++){
		if(vis[i])continue;
		for(auto e:G[i]){
			if(vis[e])continue;
			v.emplace_back(idx[i],idx[e]);
		}
		vis[i]=1;
	}
	InitMap(n-12,v.size());
	for(auto p:v){
		MakeMap(p.first,p.second);
	}
}

Compilation message

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:21:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(G[i].size()==n-2){
      ~~~~~~~~~~~^~~~~
Bob.cpp:29:15: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
   if(vis[i]==0&&a!=i){
Bob.cpp:36:16: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(auto e:G[b]){
                ^
# Verdict Execution time Memory Grader output
1 Correct 8 ms 6656 KB Output is correct
2 Correct 8 ms 6656 KB Output is correct
3 Correct 10 ms 6912 KB Output is correct
4 Correct 10 ms 6656 KB Output is correct
5 Failed 9 ms 6912 KB Wrong Answer [13]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 6656 KB Output is correct
2 Correct 8 ms 6656 KB Output is correct
3 Correct 10 ms 6912 KB Output is correct
4 Correct 10 ms 6656 KB Output is correct
5 Failed 9 ms 6912 KB Wrong Answer [13]
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 759 ms 25636 KB Output is correct : V - N = 12
2 Failed 569 ms 22816 KB Wrong Answer [13]
3 Halted 0 ms 0 KB -