# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388717 | denkendoemeer | Airline Route Map (JOI18_airline) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "Alicelib.h"
using namespace std;
void Alice(int n,int m,int a[],int b[])
{
vector<pair<int,int>>ed;
int i,j;
for(i=0;i<m;i++)
ed.emplace_back(a[i],b[i]);
for(i=0;i<n;i++)
for(j=0;j<10;j++)
if (i>>j&1)
ed.emplace_back(n+j,i);
for(i=0;i<n;i++)
ed.emplace_back(n+10,i);
for(i=1;i<10;i++)
ed.emplace_back(n+i-1,n+i);
ed.emplace_back(n+11,n+10);
InitG(n+12,ed.size());
for(i=0;i<ed.size();i++)
MakeG(i,ed[i].first,ed[i].second);
}
#include<bits/stdc++.h>
#include "Boblib.h"
using namespace std;
void bob(int n,int m,int a[],int b[])
{
vector<vector<int>>g(n);
int i;
for(i=0;i<m;i++){
g[a[i]].push_back(b[i]);
g[b[i]].push_back(a[i]);
}
vector<bool>nr(n);
int poz;
for(i=0;i<n;i++)
if (g[i].size()==1 && g[g[i][0]].size()==n-11){
poz=g[i][0];
for(auto it:g[poz])
nr[it]=1;
break;
}
int cur=poz;
for(i=0;i<n;i++)
if (i!=poz && nr[i]==0 && g[i].size()<=g[cur].size())
cur=i;
int pre=cur;
vector<int>care(n);
for(i=9;i>=0;i--){
for(auto it:g[cur])
if (nr[it])
care[it]+=1<<i;
for(auto it:g[cur])
if (nr[it]==0 && it!=pre){
pre=cur;
cur=it;
break;
}
}
vector<pair<int,int>>ed;
for(i=0;i<m;i++)
if (nr[a[i]] && nr[b[i]])
ed.emplace_back(care[a[i]],care[b[i]]);
InitMap(n-12,ed.size());
for(auto it:ed)
MakeMap(it.first,it.second);
}