답안 #68658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68658 2018-08-17T19:52:16 Z TadijaSebez 항공 노선도 (JOI18_airline) C++11
0 / 100
633 ms 30544 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[])
{
    vector<pair<int,int> > edges;
    int cen=n+10,den=n+11,i,j;
    for(i=0;i<9;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<10;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+12,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 N=n-12,M=m-9-2*n,i,j;
	vector<int> indeg;
	indeg.resize(n);
	for(i=0;i<N;i++) for(j=0;j<10;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.size()>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;
	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] && !in[i]) one=i;
	val.resize(n);
	for(i=0;i<10;i++) val[one]=i,one=go[one];
	for(i=0;i<m;i++)
	{
		if(!fk[a[i]] && fk[b[i]] && (val[b[i]] || go[b[i]])) val[a[i]]+=1<<val[b[i]];
	}
	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:20: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:18:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<fake.size();i++) fk[fake[i]]=1;
          ~^~~~~~~~~~~~
Bob.cpp:37: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:23:27: warning: 'one' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(i=0;i<10;i++) val[one]=i,one=go[one];
                           ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 6640 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 6640 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 633 ms 30544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -