# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
260460 | mhy908 | Airline Route Map (JOI18_airline) | C++14 | 1128 ms | 31008 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 "Alicelib.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
static int re;
static pii edg[2000010];
void Alice(int N, int M, int A[], int B[]){
int v=N+12;
for(int i=0; i<M; i++)edg[++re]=mp(A[i], B[i]);
for(int i=0; i<10; i++){
for(int j=0; j<N; j++){
if(j&(1<<i))edg[++re]=mp(N+i, j);
}
}
for(int i=N; i<=N+9; i++)edg[++re]=mp(i, N+10);
for(int i=0; i<=N+9; i++)edg[++re]=mp(i, N+11);
for(int i=N; i<N+9; i++)edg[++re]=mp(i, i+1);
InitG(v, re);
for(int i=1; i<=re; i++)MakeG(i-1, edg[i].F, edg[i].S);
}
#include "Boblib.h"
#include <bits/stdc++.h>
#define eb emplace_back
#define mp make_pair
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
static int ch[1510];
static vector<int> link[1510];
static pii ans[2000010], arr[100];
static int tmp;
int num[1510];
void Bob(int V, int U, int C[], int D[]){
int n, m=0;
for(int i=0; i<U; i++){
link[C[i]].eb(D[i]);
link[D[i]].eb(C[i]);
}
int maxx=0, maxnum;
for(int i=0; i<V; i++){
int sz=link[i].size();
if(maxx<sz){
maxx=sz;
maxnum=i;
}
}
ch[maxnum]=1;
for(auto i:link[maxnum])ch[i]=2;
int st, st2;
for(int i=0; i<V; i++){
if(ch[i])continue;
if(link[i].size()==10)st2=i;
}
ch[st2]=1;
int mindeg=1e9;
for(auto i:link[st2]){
if(mindeg>link[i].size()){
mindeg=link[i].size();
st=i;
}
ch[i]=0;
}
for(int i=9; ; i--){
for(auto j:link[st]){
if(ch[j]!=2)continue;
num[j]+=(1<<i);
}
if(i==0)break;
ch[st]=1;
for(auto j:link[st]){
if(!ch[j]){
st=j;
break;
}
}
}
for(int i=0; i<U; i++){
if(ch[C[i]]==2&&ch[D[i]]==2){
ans[++tmp]=mp(num[C[i]], num[D[i]]);
}
}
InitMap(V-12, tmp);
for(int i=1; i<=tmp; i++)MakeMap(ans[i].F, ans[i].S);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |