답안 #260387

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260387 2020-08-10T08:08:14 Z 문홍윤(#5075) 항공 노선도 (JOI18_airline) C++14
0 / 100
464 ms 46200 KB
#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, re2;
static pii edg[2000010];
static int arr[20][20], tmp;

void Alice(int N, int M, int A[], int B[]){
	for(int i=1; i<=N+2; i++)edg[++re]=mp(0, i);
	re2=N+3;
	for(int i=1; i<=10; i++){
        for(int j=1; j<i; j++){
            arr[j][i]=++tmp;
        }
	}
	for(int i=0; i<M; i++){
        int a=A[i], b=B[i];
        if(a>b)swap(a, b);
        int sz=arr[a][b];
        for(int j=1; j<sz; j++){
            edg[++re]=mp(re2, re2+1);
            re2++;
        }
        re2++;
	}
	InitG(re2, 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;

bool ch[1510];
vector<int> link[1510];
pii ans[2000010], arr[100];
int tmp;

int dfs(int num, int par){
    int ret=1;
    for(auto i:link[num]){
        if(i==par)continue;
        ret+=dfs(i, num);
    }
    return ret;
}

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]);
	}
	for(int i=0; i<V; i++){
        if(link[i].size()>=3){
            n=(int)link[i].size()-2;
            ch[i]=true;
            for(auto j:link[i])ch[j]=true;
            break;
        }
	}
	for(int i=1; i<=10; i++){
        for(int j=1; j<i; j++){
            arr[++tmp]=mp(j, i);
        }
	}
	for(int i=0; i<V; i++){
        if(ch[i])continue;
        int sz=dfs(i, -1);
        ans[++m]=arr[sz];
	}
	InitMap(n, m);
	for(int i=1; i<=m; i++)MakeMap(ans[i].F, ans[i].S);
}

Compilation message

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:48:9: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
  InitMap(n, m);
  ~~~~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 6912 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 6912 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 464 ms 46200 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -