Submission #265498

# Submission time Handle Problem Language Result Execution time Memory
265498 2020-08-14T22:25:59 Z doowey Airline Route Map (JOI18_airline) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "Boblib.h"
#include <cassert>
#include <cstdio>

using namespace std;

typedef pair<int, int> pii;

#define fi first
#define se second
#define mp make_pair

const int N = 1050;
vector<int> T[N];
bool hh[N];
bool gg[N];
bool vis[N];
int deg[N];
int idx[N];
bool out[N];

void Bob( int V, int U, int C[], int D[] ){
    int n = V - 13;
    int m = U;
    for(int i = 0 ; i < m; i ++ ){
        T[C[i]].push_back(D[i]);
        T[D[i]].push_back(C[i]);
    }
    int vso = -1;
    for(int i = 0 ; i < V; i ++ ){
        if(T[i].size() == n + 11){
            vso = i;
            hh[i]=true;
            for(auto x : T[i]){
                hh[x]=true;
            }
            break;
        }
    }
    int al = -1;
    for(int i = 0 ; i < V; i ++ ){
        if(!hh[i]){
            al = i;
        }
    }
    gg[vso]=true;
    for(auto x : T[al]){
        gg[x]=true;
    }
    vector<int> bits;
    for(int i = 0; i < V; i ++ ){
        if(!gg[i]){
            bits.push_back(i);
        }
    }
    for(auto x : bits){
        for(auto y : T[x]){
            if(!gg[y]){
                deg[x] ++ ;
            }
            else{
                out[x]=true;
            }
        }
    }
    vector<int> ord;
    int start = -1;
    for(auto x : bits){
        if(deg[x] == 1){
            start = x;
        }
    }
    bool went;
    for(int i = 0 ; i < bits.size(); i ++ ){
        vis[start] = true;
        ord.push_back(start);
        if(i + 1 == bits.size()) break;
        went = false;
        for(auto x : T[start]){
            if(gg[x] || vis[x]) continue;
            if(deg[x] == 2 || out[x]){
                start = x;
                went = true;
                break;
            }
        }
        if(!went){
            for(auto x : T[start]){
                if(gg[x] || vis[x] ) continue;
                start = x;
                break;
            }
        }
    }
    gg[vso] = false;
    for(int i = 0 ; i < ord.size(); i ++ ){
        for(auto x : T[ord[i]]){
            if(gg[x]){
                idx[x] += (1 << i);
            }
        }
    }
    vector<pii> sol;
    for(int i = 0 ; i < V; i ++ ){
        if(!gg[i]) continue;
        for(auto x : T[i]){
            if(!gg[x]) continue;
            if(idx[i] < idx[x])
                sol.push_back(mp(idx[i], idx[x]));
        }
    }
    InitMap(n, sol.size());
    for(auto x : sol)
        MakeMap(x.fi, x.se);
}



    

Compilation message

Alice.cpp: In function 'void Bob(int, int, int*, int*)':
Alice.cpp:32:24: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |         if(T[i].size() == n + 11){
      |            ~~~~~~~~~~~~^~~~~~~~~
Alice.cpp:75:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |     for(int i = 0 ; i < bits.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~~
Alice.cpp:78:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   78 |         if(i + 1 == bits.size()) break;
      |            ~~~~~~^~~~~~~~~~~~~~
Alice.cpp:97:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   97 |     for(int i = 0 ; i < ord.size(); i ++ ){
      |                     ~~^~~~~~~~~~~~
/tmp/ccto73uT.o: In function `Bob(int, int, int*, int*)':
Alice.cpp:(.text+0x561): undefined reference to `InitMap(int, int)'
Alice.cpp:(.text+0x586): undefined reference to `MakeMap(int, int)'
/tmp/ccaglhum.o: In function `main':
grader_alice.cpp:(.text.startup+0xe3): undefined reference to `Alice(int, int, int*, int*)'
collect2: error: ld returned 1 exit status

/tmp/ccEJZNYi.o: In function `main':
grader_bob.cpp:(.text.startup+0xcb): undefined reference to `Bob(int, int, int*, int*)'
collect2: error: ld returned 1 exit status