Submission #768321

# Submission time Handle Problem Language Result Execution time Memory
768321 2023-06-27T22:53:16 Z raysh07 Airline Route Map (JOI18_airline) C++17
Compilation error
0 ms 0 KB
#include "Alicelib.h"
#include <bits/stdc++.h>
using namespace std;

void Alice( int N, int M, int A[], int B[] ){
// 	InitG( 3, 2 );
// 	MakeG( 1, 2 );
// 	MakeG( 1, 3 );

    int n = N + 12;

    vector <pair<int, int>> e;
    for (int i = 0; i < M; i++){
        e.push_back({A[i], B[i]});
    }
    
    for (int i = 0; i < n - 1; i++){
        if (i != N) e.push_back({i, N});
    }
    
    for (int i = N + 1; i <= N + 10; i++) e.push_back({i, n - 1});
    
    for (int i = N + 2; i <= N + 9; i++) e.push_back({i, N + 10});
    
    for (int i = N = 2; i <= N + 9; i++) e.push_back({i, i - 1});
    
    InitG(n, (int)e.size());
    int curr = 0;
    for (auto [x, y] : e) MakeG(curr++, x, y);
}
#include "Boblib.h"
#include <bits/stdc++.h>
using namespace std;

void Bob(int V, int U, int C[], int D[]){
// 	InitMap( 3, 2 );
// 	MakeMap( 1, 2 );
// 	MakeMap( 1, 3 );

    int n = V- 12;
    vector<vector<bool>> has(V, vector<bool>(V, false));
    vector<int> deg(V, 0);
    
    for (int i = 0; i < U; i++){
        has[C[i]][D[i]] = true;
        has[D[i]][C[i]] = true;
        deg[C[i]]++;
        deg[D[i]]++;
    }
    
    pair<int, int> mx = {-1, -1};
    for (int i = 0; i < V; i++){
        mx = max(mx, {deg[i], i});
    }
    
    vector<pair<int, int>> e;
    set<int> bruh;
    
    int orz = -1;
    for (int i = 0; i < V; i++){
        if (i != mx.second && !has[i][mx.second]){
            assert(orz == -1);
            orz = i;
        }
    }
    
    for (int i = 0; i < V; i++){
        if (has[orz][i]){
            bruh.insert(i);
        }
    }
    
    assert(bruh.size() == 10);
    vector <int> okie(V, 0);
    for (int i = 0; i < V; i++){
        for (int j = i + 1; j < V; j++){
            if (bruh.find(i) != bruh.end() && bruh.find(j) != bruh.end() && has[i][j]){
                okie[i]++;
                okie[j]++;
            } 
        }
    }
    
    vector <int> fin(10, -1);
    vector <bool> used(v, false);
    used[orz] = true;
    used[mx.second] = true;
    for (int i = 0; i < V; i++){
        if (okie[i] == 8) fin[9] = i;
        if (okie[i] == 1) fin[0] = i;
    }
    
    int curr = fin[0];
    used[fin[0]] = true;
    used[fin[9]] = true;
    int ptr = 1;
    while (true){
        int nc = -1;
        for (int i = 0; i < V; i++){
            if (bruh.find(i) != bruh.end() && has[curr][i] && !used[i]){
                nc = i;
                break;
            }
        }
        
        if (nc == -1) break;
        used[nc] = true;
        fin[ptr++] = nc;
        curr = nc;
    }
    vector <int> ac(V, 0);
    
    for (int i = 0; i < V; i++){
        if (used[i]) continue;
        
        for (int j = 0; j < 10; j++){
            if (has[i][fin[j]]){
                ac[i] += (1 << j);
            }
        }
    }
    
    for (int i = 0; i < V; i++){
        for (int j = i + 1; j < V; j++){
            if (!used[i] && !used[j] && has[i][j]){
                e.push_back({i, j});
            }
        }
    }
    
    InitMap(n, (int)e.size());
    for (auto [x, y] : e) MakeMap(x, y);
}

Compilation message

Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:55:24: error: 'v' was not declared in this scope
   55 |     vector <bool> used(v, false);
      |                        ^