Submission #260386

# Submission time Handle Problem Language Result Execution time Memory
260386 2020-08-10T08:06:25 Z 반딧불(#5056) Airline Route Map (JOI18_airline) C++14
0 / 100
1823 ms 39568 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<N*10000000; i++){
        cnt *= 2;
    }

    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;
    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++){
                for(auto &y: specialLink[tmp]){
                    if(prv == y) continue;
                    prv = tmp;
                    vertexD[i] = tmp = y;
                    specialDegree[y] = i;
                    break;
                }
            }
            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 Incorrect 54 ms 7152 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 7152 KB Wrong Answer [11]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1716 ms 39528 KB Output is correct : V - N = 12
2 Correct 1248 ms 34672 KB Output is correct : V - N = 12
3 Correct 1060 ms 19088 KB Output is correct : V - N = 12
4 Correct 676 ms 7928 KB Output is correct : V - N = 12
5 Correct 845 ms 14008 KB Output is correct : V - N = 12
6 Correct 1129 ms 32488 KB Output is correct : V - N = 12
7 Correct 1356 ms 39232 KB Output is correct : V - N = 12
8 Correct 1295 ms 36872 KB Output is correct : V - N = 12
9 Correct 977 ms 22400 KB Output is correct : V - N = 12
10 Correct 704 ms 9200 KB Output is correct : V - N = 12
11 Correct 768 ms 10672 KB Output is correct : V - N = 12
12 Correct 1048 ms 25896 KB Output is correct : V - N = 12
13 Correct 1311 ms 38024 KB Output is correct : V - N = 12
14 Correct 1323 ms 38720 KB Output is correct : V - N = 12
15 Correct 1074 ms 31420 KB Output is correct : V - N = 12
16 Correct 792 ms 12112 KB Output is correct : V - N = 12
17 Correct 695 ms 8424 KB Output is correct : V - N = 12
18 Correct 1097 ms 20816 KB Output is correct : V - N = 12
19 Correct 1212 ms 36184 KB Output is correct : V - N = 12
20 Correct 1823 ms 39568 KB Output is correct : V - N = 12
21 Correct 570 ms 18032 KB Output is correct : V - N = 12
22 Correct 538 ms 14648 KB Output is correct : V - N = 12
23 Correct 443 ms 10640 KB Output is correct : V - N = 12
24 Correct 439 ms 7152 KB Output is correct : V - N = 12
25 Correct 434 ms 9200 KB Output is correct : V - N = 12
26 Correct 498 ms 13712 KB Output is correct : V - N = 12
27 Correct 551 ms 15736 KB Output is correct : V - N = 12
28 Correct 563 ms 15504 KB Output is correct : V - N = 12
29 Incorrect 477 ms 11312 KB Wrong Answer [11]
30 Halted 0 ms 0 KB -