Submission #260392

# Submission time Handle Problem Language Result Execution time Memory
260392 2020-08-10T08:15:33 Z 반딧불(#5056) Airline Route Map (JOI18_airline) C++14
0 / 100
823 ms 39600 KB
#include <bits/stdc++.h>
#include "Alicelib.h"

using namespace std;

typedef long long ll;

namespace AA{
    vector<int> link[1020];
    vector<pair<int, int> > edge;
    int cnt = 1;
}
using namespace AA;

void Alice(int N, int M, int A[], int B[]){
    for(int i=0; i<M; i++){ /// original graph
        link[A[i]].push_back(B[i]);
        link[B[i]].push_back(A[i]);
    }
    for(int i=0; i<N+10; i++){ /// vertex X
        link[N+11].push_back(i);
        link[i].push_back(N+11);
    }
    for(int d=0; d<10; d++){ /// vertex d0, d1, ..., d9
        for(int i=0; i<N; i++){
            if(i & (1<<d)) link[i].push_back(N+d), link[N+d].push_back(i);
        }
    }

    for(int i=0; i<10; i++){
        link[N+i].push_back(N+10);
        link[N+10].push_back(N+i);
    }

    for(int i=0; i<9; i++){
        link[N+i].push_back(N+i+1);
        link[N+i+1].push_back(N+i);
    }

    for(int i=0; i<N+12; i++){
        for(auto &j: link[i]){
            if(i < j) edge.push_back(make_pair(i, j));
        }
    }

    InitG(N+12, (int)edge.size());
    int cnt = 0;
    for(auto &x: edge){
        MakeG(cnt++, x.first, x.second);
    }
}
#include <bits/stdc++.h>
#include "Boblib.h"

using namespace std;

typedef long long ll;

namespace BB{
    int n, m;
    int idx[1020];
    vector<int> glink[1020];
    vector<int> link[1002];

    int vertexX, vertexY;
    int vertexD[10];
    vector<int> specialVertices;
    bool isSpecial[1020];
    int specialDegree[1020];

    vector<int> specialLink[1020];

    vector<pair<int, int> > edge;
}
using namespace BB;

void Bob(int V, int U, int C[], int D[]){
    n = V-12;
    if(n==1){
        InitMap(1, 0);
        return;
    }

    for(int i=0; i<U; i++){
        glink[C[i]].push_back(D[i]);
        glink[D[i]].push_back(C[i]);
    }

    for(int i=0; i<V; i++){
        if((int)glink[i].size() == n+10){
            vertexX = i;

            for(int j=0; j<V; j++) isSpecial[j] = 1;
            isSpecial[i] = 0;
            for(auto &x: glink[i]) isSpecial[x] = 0;

            for(int j=0; j<V; j++){
                if(isSpecial[j]) specialVertices.push_back(j);
            }
            vertexY = specialVertices[0];
            isSpecial[vertexY] = 0;

            specialVertices.clear();
            for(auto &x: glink[vertexY]){
                specialVertices.push_back(x);
                isSpecial[x] = 1;
            }
            break;
        }
    }

    int onedeg = 0;
    for(auto &x: specialVertices){
        for(auto &y: glink[x]){
            if(isSpecial[y]){
                specialDegree[x]++;
                specialLink[x].push_back(y);
                specialLink[y].push_back(x);
            }
        }
        if(specialDegree[x] == 1) onedeg = max(onedeg, (int)glink[x].size());
    }
    for(auto &x: specialVertices){
        if(specialDegree[x] == 1 && onedeg == (int)glink[x].size()){
            vertexD[0] = x;
            specialDegree[x] = 0;

            int tmp = x, prv = 0;
            for(int i=1; i<10; i++){
                vertexD[i] = -1;
                for(auto &y: specialLink[tmp]){
                    if(prv == y) continue;
                    prv = tmp;
                    vertexD[i] = tmp = y;
                    specialDegree[y] = i;
                    break;
                }
                if(vertexD[i] == -1) exit(1);
            }
            break;
        }
    }

    for(int i=0; i<V; i++){
        if(isSpecial[i] || i == vertexX || i == vertexY) continue;

        for(auto &x: glink[i]){
            if(isSpecial[x]) idx[i] += 1 << specialDegree[x];
        }
    }

    for(int i=0; i<V; i++){
        if(isSpecial[i] || i == vertexX || i == vertexY) continue;

        for(auto &x: glink[i]){
            if(!isSpecial[x] && x != vertexX){
                link[idx[i]].push_back(idx[x]);
            }
        }
    }

    for(int i=0; i<n; i++){
        for(auto &x: link[i]){
            if(i < x){
                edge.push_back(make_pair(i, x));
            }
        }
    }

    InitMap(n, (int)edge.size());
    for(auto &x: edge){
        MakeMap(x.first, x.second);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6912 KB Output is correct
2 Correct 5 ms 6912 KB Output is correct
3 Correct 5 ms 6912 KB Output is correct
4 Correct 5 ms 6912 KB Output is correct
5 Correct 5 ms 6912 KB Output is correct
6 Correct 5 ms 6912 KB Output is correct
7 Correct 5 ms 6912 KB Output is correct
8 Correct 6 ms 6912 KB Output is correct
9 Correct 5 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 5 ms 6912 KB Output is correct
13 Correct 5 ms 6912 KB Output is correct
14 Correct 5 ms 6912 KB Output is correct
15 Correct 6 ms 6912 KB Output is correct
16 Correct 6 ms 6912 KB Output is correct
17 Correct 7 ms 6912 KB Output is correct
18 Correct 6 ms 6912 KB Output is correct
19 Correct 5 ms 6912 KB Output is correct
20 Correct 5 ms 6912 KB Output is correct
21 Correct 6 ms 6912 KB Output is correct
22 Correct 5 ms 6912 KB Output is correct
23 Correct 5 ms 6912 KB Output is correct
24 Correct 6 ms 6912 KB Output is correct
25 Correct 5 ms 6912 KB Output is correct
26 Correct 6 ms 6912 KB Output is correct
27 Correct 5 ms 6912 KB Output is correct
28 Correct 6 ms 6912 KB Output is correct
29 Correct 5 ms 6912 KB Output is correct
30 Runtime error 5 ms 6912 KB Execution failed because the return code was nonzero
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 6912 KB Output is correct
2 Correct 5 ms 6912 KB Output is correct
3 Correct 5 ms 6912 KB Output is correct
4 Correct 5 ms 6912 KB Output is correct
5 Correct 5 ms 6912 KB Output is correct
6 Correct 5 ms 6912 KB Output is correct
7 Correct 5 ms 6912 KB Output is correct
8 Correct 6 ms 6912 KB Output is correct
9 Correct 5 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 5 ms 6912 KB Output is correct
13 Correct 5 ms 6912 KB Output is correct
14 Correct 5 ms 6912 KB Output is correct
15 Correct 6 ms 6912 KB Output is correct
16 Correct 6 ms 6912 KB Output is correct
17 Correct 7 ms 6912 KB Output is correct
18 Correct 6 ms 6912 KB Output is correct
19 Correct 5 ms 6912 KB Output is correct
20 Correct 5 ms 6912 KB Output is correct
21 Correct 6 ms 6912 KB Output is correct
22 Correct 5 ms 6912 KB Output is correct
23 Correct 5 ms 6912 KB Output is correct
24 Correct 6 ms 6912 KB Output is correct
25 Correct 5 ms 6912 KB Output is correct
26 Correct 6 ms 6912 KB Output is correct
27 Correct 5 ms 6912 KB Output is correct
28 Correct 6 ms 6912 KB Output is correct
29 Correct 5 ms 6912 KB Output is correct
30 Runtime error 5 ms 6912 KB Execution failed because the return code was nonzero
31 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 707 ms 39416 KB Output is correct : V - N = 12
2 Correct 561 ms 34412 KB Output is correct : V - N = 12
3 Correct 220 ms 18984 KB Output is correct : V - N = 12
4 Correct 15 ms 7680 KB Output is correct : V - N = 12
5 Correct 132 ms 13984 KB Output is correct : V - N = 12
6 Correct 472 ms 32508 KB Output is correct : V - N = 12
7 Correct 703 ms 39160 KB Output is correct : V - N = 12
8 Correct 624 ms 37064 KB Output is correct : V - N = 12
9 Correct 313 ms 22168 KB Output is correct : V - N = 12
10 Correct 48 ms 9216 KB Output is correct : V - N = 12
11 Correct 67 ms 10672 KB Output is correct : V - N = 12
12 Correct 354 ms 25800 KB Output is correct : V - N = 12
13 Correct 666 ms 37912 KB Output is correct : V - N = 12
14 Correct 639 ms 38544 KB Output is correct : V - N = 12
15 Correct 388 ms 31400 KB Output is correct : V - N = 12
16 Correct 100 ms 12104 KB Output is correct : V - N = 12
17 Correct 26 ms 8440 KB Output is correct : V - N = 12
18 Correct 268 ms 20560 KB Output is correct : V - N = 12
19 Correct 595 ms 36416 KB Output is correct : V - N = 12
20 Correct 694 ms 39440 KB Output is correct : V - N = 12
21 Correct 200 ms 17768 KB Output is correct : V - N = 12
22 Correct 145 ms 14440 KB Output is correct : V - N = 12
23 Correct 61 ms 10456 KB Output is correct : V - N = 12
24 Correct 8 ms 7168 KB Output is correct : V - N = 12
25 Correct 43 ms 9152 KB Output is correct : V - N = 12
26 Correct 134 ms 13800 KB Output is correct : V - N = 12
27 Correct 178 ms 15864 KB Output is correct : V - N = 12
28 Correct 165 ms 15136 KB Output is correct : V - N = 12
29 Correct 81 ms 11472 KB Output is correct : V - N = 12
30 Correct 14 ms 7928 KB Output is correct : V - N = 12
31 Correct 13 ms 7424 KB Output is correct : V - N = 12
32 Correct 12 ms 7424 KB Output is correct : V - N = 12
33 Correct 13 ms 7424 KB Output is correct : V - N = 12
34 Correct 12 ms 7424 KB Output is correct : V - N = 12
35 Correct 12 ms 7424 KB Output is correct : V - N = 12
36 Correct 747 ms 39256 KB Output is correct : V - N = 12
37 Correct 718 ms 39312 KB Output is correct : V - N = 12
38 Correct 703 ms 39400 KB Output is correct : V - N = 12
39 Correct 813 ms 39600 KB Output is correct : V - N = 12
40 Correct 823 ms 39432 KB Output is correct : V - N = 12
41 Correct 128 ms 13608 KB Output is correct : V - N = 12
42 Correct 114 ms 12552 KB Output is correct : V - N = 12
43 Correct 117 ms 13352 KB Output is correct : V - N = 12
44 Correct 15 ms 7424 KB Output is correct : V - N = 12
45 Correct 76 ms 10800 KB Output is correct : V - N = 12
46 Correct 274 ms 19608 KB Output is correct : V - N = 12
47 Correct 148 ms 13600 KB Output is correct : V - N = 12
48 Correct 297 ms 22296 KB Output is correct : V - N = 12
49 Correct 54 ms 10416 KB Output is correct : V - N = 12
50 Correct 27 ms 8336 KB Output is correct : V - N = 12
51 Correct 556 ms 34512 KB Output is correct : V - N = 12
52 Correct 16 ms 7680 KB Output is correct : V - N = 12
53 Correct 498 ms 32344 KB Output is correct : V - N = 12
54 Correct 630 ms 36328 KB Output is correct : V - N = 12
55 Correct 39 ms 9224 KB Output is correct : V - N = 12
56 Correct 398 ms 25128 KB Output is correct : V - N = 12
57 Correct 656 ms 37888 KB Output is correct : V - N = 12
58 Correct 94 ms 12000 KB Output is correct : V - N = 12
59 Correct 258 ms 20392 KB Output is correct : V - N = 12
60 Correct 790 ms 38736 KB Output is correct : V - N = 12
61 Correct 8 ms 6912 KB Output is correct : V - N = 12
62 Correct 6 ms 6912 KB Output is correct : V - N = 12
63 Correct 8 ms 6912 KB Output is correct : V - N = 12
64 Correct 7 ms 6912 KB Output is correct : V - N = 12
65 Correct 6 ms 6912 KB Output is correct : V - N = 12
66 Correct 7 ms 6912 KB Output is correct : V - N = 12
67 Correct 6 ms 6912 KB Output is correct : V - N = 12
68 Correct 6 ms 6912 KB Output is correct : V - N = 12
69 Correct 6 ms 6912 KB Output is correct : V - N = 12
70 Correct 5 ms 6912 KB Output is correct : V - N = 12
71 Correct 5 ms 6912 KB Output is correct : V - N = 12
72 Correct 5 ms 6912 KB Output is correct : V - N = 12
73 Correct 7 ms 6912 KB Output is correct : V - N = 12
74 Correct 6 ms 6912 KB Output is correct : V - N = 12
75 Correct 7 ms 6912 KB Output is correct : V - N = 12
76 Correct 6 ms 6912 KB Output is correct : V - N = 12
77 Correct 5 ms 6912 KB Output is correct : V - N = 12
78 Correct 6 ms 6912 KB Output is correct : V - N = 12
79 Correct 7 ms 6912 KB Output is correct : V - N = 12
80 Correct 6 ms 6912 KB Output is correct : V - N = 12
81 Correct 6 ms 6912 KB Output is correct : V - N = 12
82 Correct 7 ms 6912 KB Output is correct : V - N = 12
83 Correct 6 ms 6912 KB Output is correct : V - N = 12
84 Correct 5 ms 6912 KB Output is correct : V - N = 12
85 Correct 5 ms 6912 KB Output is correct : V - N = 12
86 Correct 6 ms 6912 KB Output is correct : V - N = 12
87 Correct 6 ms 6912 KB Output is correct : V - N = 12
88 Correct 6 ms 6912 KB Output is correct : V - N = 12
89 Correct 6 ms 6912 KB Output is correct : V - N = 12
90 Correct 5 ms 6912 KB Output is correct : V - N = 12
91 Correct 6 ms 6912 KB Output is correct : V - N = 12
92 Correct 5 ms 6912 KB Output is correct : V - N = 12
93 Correct 6 ms 6912 KB Output is correct : V - N = 12
94 Correct 6 ms 6912 KB Output is correct : V - N = 12
95 Correct 5 ms 6912 KB Output is correct : V - N = 12
96 Correct 6 ms 6912 KB Output is correct : V - N = 12
97 Correct 7 ms 6912 KB Output is correct : V - N = 12
98 Correct 7 ms 6912 KB Output is correct : V - N = 12
99 Correct 7 ms 7168 KB Output is correct : V - N = 12
100 Correct 6 ms 6912 KB Output is correct : V - N = 12
101 Correct 6 ms 6912 KB Output is correct : V - N = 12
102 Correct 6 ms 6912 KB Output is correct : V - N = 12
103 Correct 7 ms 6912 KB Output is correct : V - N = 12
104 Correct 6 ms 6912 KB Output is correct : V - N = 12
105 Correct 7 ms 6912 KB Output is correct : V - N = 12
106 Correct 7 ms 6912 KB Output is correct : V - N = 12
107 Correct 6 ms 6912 KB Output is correct : V - N = 12
108 Correct 7 ms 6912 KB Output is correct : V - N = 12
109 Correct 6 ms 6912 KB Output is correct : V - N = 12
110 Correct 7 ms 6912 KB Output is correct : V - N = 12
111 Correct 7 ms 6976 KB Output is correct : V - N = 12
112 Correct 5 ms 6912 KB Output is correct : V - N = 12
113 Correct 7 ms 6912 KB Output is correct : V - N = 12
114 Correct 6 ms 6912 KB Output is correct : V - N = 12
115 Correct 6 ms 6912 KB Output is correct : V - N = 12
116 Correct 5 ms 6912 KB Output is correct : V - N = 12
117 Correct 7 ms 6912 KB Output is correct : V - N = 12
118 Correct 5 ms 6912 KB Output is correct : V - N = 12
119 Correct 5 ms 6912 KB Output is correct : V - N = 12
120 Correct 5 ms 6912 KB Output is correct : V - N = 12
121 Correct 6 ms 6912 KB Output is correct : V - N = 12
122 Correct 6 ms 6912 KB Output is correct : V - N = 12
123 Correct 5 ms 7168 KB Output is correct : V - N = 12
124 Correct 5 ms 6912 KB Output is correct : V - N = 12
125 Correct 5 ms 6912 KB Output is correct : V - N = 12
126 Correct 5 ms 6912 KB Output is correct : V - N = 12
127 Correct 5 ms 6912 KB Output is correct : V - N = 12
128 Correct 5 ms 6912 KB Output is correct : V - N = 12
129 Runtime error 5 ms 6912 KB Execution failed because the return code was nonzero
130 Halted 0 ms 0 KB -