Submission #73711

# Submission time Handle Problem Language Result Execution time Memory
73711 2018-08-28T17:59:57 Z TadijaSebez Airline Route Map (JOI18_airline) C++11
0 / 100
642 ms 30672 KB
#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void Alice(int n, int m, int a[], int b[])
{
	int L=10;
    vector<pair<int,int> > edges;
    int cen=n+L,den=n+L+1,i,j;
    for(i=0;i<L-1;i++) edges.pb(mp(n+i,n+i+1));
    for(i=0;i<n;i++)
	{
		edges.pb(mp(i,cen));
		edges.pb(mp(i,den));
		for(j=0;j<L;j++) if((i>>j)&1) edges.pb(mp(i,n+j));
	}
	for(i=0;i<m;i++) edges.pb(mp(a[i],b[i]));
	InitG(n+L+2,edges.size());
	for(i=0;i<edges.size();i++) MakeG(i,edges[i].first,edges[i].second);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
void Bob(int n, int m, int a[], int b[])
{
	int L=10;
	int N=n-L-2,M=m-9-2*n,i,j;
	vector<int> indeg;
	indeg.resize(n);
	//for(i=0;i<N;i++) for(j=0;j<L;j++) if((i>>j)&1) M--;
	for(i=0;i<m;i++) indeg[a[i]]++;
	vector<int> real,fake,val,go,in;
	vector<bool> fk;
	for(i=0;i<n;i++){ if(indeg[i]>1) real.pb(i);else fake.pb(i);}
	fk.resize(n);go.resize(n);in.resize(n);
	for(i=0;i<fake.size();i++) fk[fake[i]]=1;
	//printf("Fake: ");for(i=0;i<fake.size();i++) printf("%i ",fake[i]);printf("\n");
	for(i=0;i<n;i++) in[i]=go[i]=-1;
	for(i=0;i<m;i++) if(fk[a[i]] && fk[b[i]]) go[a[i]]=b[i],in[b[i]]=a[i];
	int one;
	for(i=0;i<n;i++) if(go[i]!=-1 && in[i]==-1) one=i;
	val.resize(n);
	for(i=0;i<L;i++) val[one]=i,one=go[one];
	for(i=0;i<m;i++)
	{
		if(!fk[a[i]] && fk[b[i]] && (go[b[i]]!=-1 || in[b[i]]!=-1)) val[a[i]]+=1<<val[b[i]];
	}
	//printf("Val: ");for(i=0;i<n;i++) printf("%i ",val[i]);printf("\n");
	vector<pair<int,int> > edges;
	for(i=0;i<m;i++)
	{
		if(!fk[a[i]] && !fk[b[i]])
		{
			edges.pb(mp(val[a[i]],val[b[i]]));
		}
	}
	InitMap(N,edges.size());
	for(i=0;i<edges.size();i++) MakeMap(edges[i].first,edges[i].second);
}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:21:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<edges.size();i++) MakeG(i,edges[i].first,edges[i].second);
          ~^~~~~~~~~~~~~

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:19:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<fake.size();i++) fk[fake[i]]=1;
          ~^~~~~~~~~~~~
Bob.cpp:41:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<edges.size();i++) MakeMap(edges[i].first,edges[i].second);
          ~^~~~~~~~~~~~~
Bob.cpp:10:14: warning: unused variable 'M' [-Wunused-variable]
  int N=n-L-2,M=m-9-2*n,i,j;
              ^
Bob.cpp:10:26: warning: unused variable 'j' [-Wunused-variable]
  int N=n-L-2,M=m-9-2*n,i,j;
                          ^
Bob.cpp:26:26: warning: 'one' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(i=0;i<L;i++) val[one]=i,one=go[one];
                          ^
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 6640 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 6640 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 642 ms 30672 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -