Submission #236320

# Submission time Handle Problem Language Result Execution time Memory
236320 2020-06-01T10:28:09 Z kshitij_sodani Airline Route Map (JOI18_airline) C++17
0 / 100
663 ms 33484 KB
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second

#include "Alicelib.h"

map<int,int> x;

void Alice(int n, int m, int aa[], int bb[]){
	for(int i=0;i<1000;i++){
		x[i]=i;
	}
	x[511]=1003;
	x[767]=1005;
	x[895]=1006;
	x[959]=1011;
	x[991]=1013;

	vector<pair<int,int>> ans;
	for(int i=0;i<m;i++){
		ans.pb({aa[i],bb[i]});
	}
	for(int ii=0;ii<n;ii++){
		int i=x[ii];
		for(int j=0;j<10;j++){
			if(i&(1<<j)){
				ans.pb({n+2+j,ii});
			}
		}
	}
	for(int i=0;i<n;i++){
		ans.pb({n+1,i});
	}
	for(int j=0;j<n+12;j++){
		if(j==n or j==n+1){
			continue;
		}
		ans.pb({n,j});
	}
	int co=9;
	for(int i=n+2;i<n+12;i++){
		for(int j=i+1;j<i+1+co;j++){
			ans.pb({i,j});
		}
		co-=1;
	}
	InitG(n+12,ans.size());
	int kk=0;
	for(auto j:ans){
		MakeG(kk,j.a,j.b);
		kk+=1;
	}
}

/*int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	return 0;
}*/
#include <bits/stdc++.h>
using namespace std;
typedef int64_t llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second


#include "Boblib.h"

map<int,int> x;
vector<int> adj[1012];
int mat[1012][1012];
int vis[1012];
void Bob(int nn, int m, int aa[], int bb[]){
	for(int i=0;i<1000;i++){
		x[i]=i;
	}
	for(int j=0;j<1012;j++){
		vis[j]=0;
	}
	for(int i=0;i<1012;i++){
		for(int j=0;j<1012;j++){
			mat[i][j]=0;
		}
	}
	for(int i=0;i<m;i++){
		mat[aa[i]][bb[i]]=1;
		mat[bb[i]][aa[i]]=1;
		adj[aa[i]].pb(bb[i]);
		adj[bb[i]].pb(aa[i]);
	}
	x[1003]=511;
	x[1005]=767;
	x[1006]=895;
	x[1011]=959;
	x[1013]=991;
	int co[nn];
	for(int i=0;i<nn;i++){
		co[i]=0;
	}
	for(int i=0;i<m;i++){
		co[aa[i]]+=1;
		co[bb[i]]+=1;
	}
	int ind;
	for(int i=0;i<nn;i++){
		if(co[i]==nn-2){
			ind=i;
		}
	}
	int ind2;
	for(int j=0;j<nn;j++){
		if(j!=ind and mat[ind][j]==0){
			ind2=j;
		}
	}
	vector<int> ext;
	for(int i=0;i<nn;i++){
		if(i==ind or i==ind2){
			continue;
		}
		if(mat[ind2][i]==0){
			ext.pb(i);
		}
	}
	if(ext.size()!=10){
		while(true){
			continue;
		}
	}
	int ext2[10];
	int co2[10];
	for(int i=0;i<10;i++){
		co2[i]=0;
	}
	for(int ii=0;ii<ext.size();ii++){
		for(int jj=ii+1;jj<ext.size();jj++){
			int i=ext[ii];
			int j=ext[jj];
			if(i==j){
				continue;
			}
			if(mat[i][j]){
				co2[i]+=1;
				co2[j]+=1;
			}
		}
	}
	for(int i=0;i<10;i++){
		ext2[9-co2[i]]=ext[i];
	}
	for(int i=0;i<10;i++){
		vis[ext2[i]]=1;
	}
	vis[ind]=1;
	vis[ind2]=1;
	for(int i=0;i<10;i++){
		for(auto j:adj[ext2[i]]){
			if(vis[j]<=0){
				vis[j]-=(1<<i);
			}
		}
	}

	vector<pair<int,int>> ans;
	for(int i=0;i<nn;i++){
		for(int j=i+1;j<nn;j++){
			if(mat[i][j]==1 and vis[i]<=0 and vis[j]<=0){
				ans.pb({x[-vis[i]],x[-vis[j]]});
			}
		}
	}
	InitMap(nn-12,ans.size());
	for(auto i:ans){
		MakeMap(i.a,i.b);
	}
}

/*int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	return 0;
}*/

Compilation message

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:78:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int ii=0;ii<ext.size();ii++){
               ~~^~~~~~~~~~~
Bob.cpp:79:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int jj=ii+1;jj<ext.size();jj++){
                   ~~^~~~~~~~~~~
Bob.cpp:98:11: warning: 'ind2' may be used uninitialized in this function [-Wmaybe-uninitialized]
  vis[ind2]=1;
  ~~~~~~~~~^~
Bob.cpp:97:10: warning: 'ind' may be used uninitialized in this function [-Wmaybe-uninitialized]
  vis[ind]=1;
  ~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 8968 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 8968 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 663 ms 33484 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -