답안 #260388

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260388 2020-08-10T08:09:19 Z 문홍윤(#5075) 항공 노선도 (JOI18_airline) C++14
22 / 100
454 ms 46372 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;

int re, re2;
pii edg[2000010];
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=0; i<N; i++){
        for(int j=0; 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;

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

static int dfs(int num, int par){
    int ret=1;
    ch[num]=true;
    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=0; i<n; i++){
        for(int j=0; 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:39:16: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(int i=0; i<n; i++){
               ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 6912 KB Output is correct
2 Correct 6 ms 6912 KB Output is correct
3 Correct 5 ms 6912 KB Output is correct
4 Correct 6 ms 6912 KB Output is correct
5 Correct 5 ms 6912 KB Output is correct
6 Correct 7 ms 6912 KB Output is correct
7 Correct 7 ms 6912 KB Output is correct
8 Correct 6 ms 6912 KB Output is correct
9 Correct 6 ms 6912 KB Output is correct
10 Correct 5 ms 6912 KB Output is correct
11 Correct 5 ms 6912 KB Output is correct
12 Correct 6 ms 6912 KB Output is correct
13 Correct 6 ms 6912 KB Output is correct
14 Correct 6 ms 6912 KB Output is correct
15 Correct 5 ms 6912 KB Output is correct
16 Correct 5 ms 6912 KB Output is correct
17 Correct 6 ms 6912 KB Output is correct
18 Correct 6 ms 6912 KB Output is correct
19 Correct 6 ms 6912 KB Output is correct
20 Correct 6 ms 6912 KB Output is correct
21 Correct 6 ms 6912 KB Output is correct
22 Correct 7 ms 6912 KB Output is correct
23 Correct 5 ms 6912 KB Output is correct
24 Correct 5 ms 6912 KB Output is correct
25 Correct 6 ms 6912 KB Output is correct
26 Correct 5 ms 6912 KB Output is correct
27 Correct 5 ms 6912 KB Output is correct
28 Correct 5 ms 6912 KB Output is correct
29 Correct 5 ms 6912 KB Output is correct
30 Correct 6 ms 6912 KB Output is correct
31 Correct 5 ms 6912 KB Output is correct
32 Correct 5 ms 6768 KB Output is correct
33 Correct 5 ms 6912 KB Output is correct
34 Correct 6 ms 6912 KB Output is correct
35 Correct 6 ms 6912 KB Output is correct
36 Correct 7 ms 6912 KB Output is correct
37 Correct 6 ms 6912 KB Output is correct
38 Correct 6 ms 6912 KB Output is correct
39 Correct 7 ms 6912 KB Output is correct
40 Correct 6 ms 6912 KB Output is correct
41 Correct 5 ms 6912 KB Output is correct
42 Correct 6 ms 6912 KB Output is correct
43 Correct 6 ms 6912 KB Output is correct
44 Correct 6 ms 6912 KB Output is correct
45 Correct 5 ms 6912 KB Output is correct
46 Correct 5 ms 6912 KB Output is correct
47 Correct 6 ms 6912 KB Output is correct
48 Correct 5 ms 6912 KB Output is correct
49 Correct 5 ms 7168 KB Output is correct
50 Correct 5 ms 6912 KB Output is correct
51 Correct 5 ms 6912 KB Output is correct
52 Correct 5 ms 6912 KB Output is correct
53 Correct 5 ms 6912 KB Output is correct
54 Correct 5 ms 7168 KB Output is correct
55 Correct 5 ms 6912 KB Output is correct
56 Correct 5 ms 6912 KB Output is correct
57 Correct 5 ms 6912 KB Output is correct
58 Correct 6 ms 6912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 6912 KB Output is correct
2 Correct 6 ms 6912 KB Output is correct
3 Correct 5 ms 6912 KB Output is correct
4 Correct 6 ms 6912 KB Output is correct
5 Correct 5 ms 6912 KB Output is correct
6 Correct 7 ms 6912 KB Output is correct
7 Correct 7 ms 6912 KB Output is correct
8 Correct 6 ms 6912 KB Output is correct
9 Correct 6 ms 6912 KB Output is correct
10 Correct 5 ms 6912 KB Output is correct
11 Correct 5 ms 6912 KB Output is correct
12 Correct 6 ms 6912 KB Output is correct
13 Correct 6 ms 6912 KB Output is correct
14 Correct 6 ms 6912 KB Output is correct
15 Correct 5 ms 6912 KB Output is correct
16 Correct 5 ms 6912 KB Output is correct
17 Correct 6 ms 6912 KB Output is correct
18 Correct 6 ms 6912 KB Output is correct
19 Correct 6 ms 6912 KB Output is correct
20 Correct 6 ms 6912 KB Output is correct
21 Correct 6 ms 6912 KB Output is correct
22 Correct 7 ms 6912 KB Output is correct
23 Correct 5 ms 6912 KB Output is correct
24 Correct 5 ms 6912 KB Output is correct
25 Correct 6 ms 6912 KB Output is correct
26 Correct 5 ms 6912 KB Output is correct
27 Correct 5 ms 6912 KB Output is correct
28 Correct 5 ms 6912 KB Output is correct
29 Correct 5 ms 6912 KB Output is correct
30 Correct 6 ms 6912 KB Output is correct
31 Correct 5 ms 6912 KB Output is correct
32 Correct 5 ms 6768 KB Output is correct
33 Correct 5 ms 6912 KB Output is correct
34 Correct 6 ms 6912 KB Output is correct
35 Correct 6 ms 6912 KB Output is correct
36 Correct 7 ms 6912 KB Output is correct
37 Correct 6 ms 6912 KB Output is correct
38 Correct 6 ms 6912 KB Output is correct
39 Correct 7 ms 6912 KB Output is correct
40 Correct 6 ms 6912 KB Output is correct
41 Correct 5 ms 6912 KB Output is correct
42 Correct 6 ms 6912 KB Output is correct
43 Correct 6 ms 6912 KB Output is correct
44 Correct 6 ms 6912 KB Output is correct
45 Correct 5 ms 6912 KB Output is correct
46 Correct 5 ms 6912 KB Output is correct
47 Correct 6 ms 6912 KB Output is correct
48 Correct 5 ms 6912 KB Output is correct
49 Correct 5 ms 7168 KB Output is correct
50 Correct 5 ms 6912 KB Output is correct
51 Correct 5 ms 6912 KB Output is correct
52 Correct 5 ms 6912 KB Output is correct
53 Correct 5 ms 6912 KB Output is correct
54 Correct 5 ms 7168 KB Output is correct
55 Correct 5 ms 6912 KB Output is correct
56 Correct 5 ms 6912 KB Output is correct
57 Correct 5 ms 6912 KB Output is correct
58 Correct 6 ms 6912 KB Output is correct
59 Incorrect 5 ms 5888 KB Wrong Answer [1]
60 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 454 ms 46372 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -