Submission #565924

# Submission time Handle Problem Language Result Execution time Memory
565924 2022-05-21T14:31:41 Z Spade1 Airline Route Map (JOI18_airline) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "Alicelib.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;

int cnt = 0;

void Alice(int N, int M, int A[], int B[]) {
    int binarycount = 0;
    for (int i = 1; i <= N; ++i) {
        binarycount += __builtin_popcount(i);
    }
    initG(N+12, N+M+binarycount+10);
    for (int i = 0; i < M; ++i) {
        MakeG(cnt++, A[i], B[i]);
    }
    for (int i = 0; i < N; ++i) {
        MakeG(cnt++, N, i);
    }
    MakeG(N+1, N);
    for (int i = N+2; i < N+11; ++i) {
        MakeG(cnt++, i, i+1);
    }
    for (int i = 1; i <= N; ++i) {
        for (int j = 1; j <= 10; ++j) {
            if (i & (1<<j)) MakeG(cnt++, i, N+1+j);
        }
    }
}
#include<bits/stdc++.h>
#include "Boblib.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define ll long long
#define ld long double
#define st first
#define nd second
#define pb push_back
#define INF INT_MAX
using namespace std;

vector<int> adj;
int unmap[1050];
int bit[11];
bool part[1050];
int deg[1050];
set<int> sbit;

void findbit(int i) {
    if (i == 10) return;
    for (auto j : adj[bit[i]]) {
        if (!sbit.count(j) && !part[j]) {
            bit[i+1] = j;
            break;
        }
    }
    findbit(i+1);
}

void Bob(int V, int U, int C[], int D[]) {
    int binarycount = 0;
    memset(upmap, -1, sizeof(unmap));
    int N = V-12, M = U-V+2-binarycount;
    for (int i = 1; i <= (V-12); ++i) {
        binarycount += __builtin_popcount(i);
    }
    InitMap(N, M);
    for (int i = 0; i < V; ++i) {
        adj[C[i]].pb(D[i]);
        adj[D[i]].pb(C[i]);
        deg[C[i]]++, deg[D[i]]++;
    }
    int key, ckey;
    for (int i = 0; i < V; ++i) {
        if (deg[i] == 1 && deg[adj[i][0]] == N+1) {
            key = adj[i][0];
            ckey = i;
        }
    }

    for (int i = 0; i < V; ++i) {
        if (i == key || i == ckey) continue;
        for (auto j : adj[i]) {
            if (j == key) part[i] = 1;;
        }
    }

    vector<int> edge;
    for (int i = 0; i < V; ++i) {
        if (!part[i]) {
            int cnt = 0;
            for (auto j : adj[i]) {
                if (part[i]) continue;
                cnt++;
            }
            if (cnt == 1) ed.pb(i);
        }
    }

    if (adj[edge[0]].size() > adj[edge[1]].size()) bit[1] = edge[0];
    else bit[1] = edge[1];

    sbit.insert(bit[1]);
    findbit(1);

    for (int i = 0; i < V; ++i) {
        if (i == key || i == ckey) continue;
        if (sbit.count(i)) continue;
        for (int j = 1; j <= 10; ++j) {
            if (i & (1<<j)) unmap[i] += (1<<j);
        }
    }

    for (int i = 0; i < U; ++i) {
        if (unmap[C[i]] == -1) continue;
        if (unmap[D[i]] == -1) continue;
        MakeMap(unmap[D[i]], unmap[C[i]]);
    }
}

Compilation message

Alice.cpp: In function 'void Alice(int, int, int*, int*)':
Alice.cpp:20:5: error: 'initG' was not declared in this scope; did you mean 'InitG'?
   20 |     initG(N+12, N+M+binarycount+10);
      |     ^~~~~
      |     InitG
Alice.cpp:27:17: error: too few arguments to function 'void MakeG(int, int, int)'
   27 |     MakeG(N+1, N);
      |                 ^
In file included from Alice.cpp:2:
Alicelib.h:3:6: note: declared here
    3 | void MakeG( int pos, int C, int D );
      |      ^~~~~

Bob.cpp: In function 'void findbit(int)':
Bob.cpp:22:29: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   22 |     for (auto j : adj[bit[i]]) {
      |                             ^
      |                             std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
Bob.cpp:22:29: error: 'end' was not declared in this scope; did you mean 'std::end'?
   22 |     for (auto j : adj[bit[i]]) {
      |                             ^
      |                             std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
Bob.cpp: In function 'void Bob(int, int, int*, int*)':
Bob.cpp:33:12: error: 'upmap' was not declared in this scope; did you mean 'unmap'?
   33 |     memset(upmap, -1, sizeof(unmap));
      |            ^~~~~
      |            unmap
Bob.cpp:9:12: error: request for member 'push_back' in 'adj.std::vector<int>::operator[](((std::vector<int>::size_type)(*(C + ((sizetype)(((long unsigned int)i) * 4))))))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    9 | #define pb push_back
      |            ^~~~~~~~~
Bob.cpp:40:19: note: in expansion of macro 'pb'
   40 |         adj[C[i]].pb(D[i]);
      |                   ^~
Bob.cpp:9:12: error: request for member 'push_back' in 'adj.std::vector<int>::operator[](((std::vector<int>::size_type)(*(D + ((sizetype)(((long unsigned int)i) * 4))))))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
    9 | #define pb push_back
      |            ^~~~~~~~~
Bob.cpp:41:19: note: in expansion of macro 'pb'
   41 |         adj[D[i]].pb(C[i]);
      |                   ^~
Bob.cpp:46:38: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   46 |         if (deg[i] == 1 && deg[adj[i][0]] == N+1) {
      |                                      ^
Bob.cpp:47:25: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   47 |             key = adj[i][0];
      |                         ^
Bob.cpp:54:28: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   54 |         for (auto j : adj[i]) {
      |                            ^
      |                            std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
Bob.cpp:54:28: error: 'end' was not declared in this scope; did you mean 'std::end'?
   54 |         for (auto j : adj[i]) {
      |                            ^
      |                            std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
Bob.cpp:63:32: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
   63 |             for (auto j : adj[i]) {
      |                                ^
      |                                std::begin
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1224:5: note: 'std::begin' declared here
 1224 |     begin(const valarray<_Tp>& __va)
      |     ^~~~~
Bob.cpp:63:32: error: 'end' was not declared in this scope; did you mean 'std::end'?
   63 |             for (auto j : adj[i]) {
      |                                ^
      |                                std::end
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:95,
                 from Bob.cpp:1:
/usr/include/c++/10/valarray:1244:5: note: 'std::end' declared here
 1244 |     end(const valarray<_Tp>& __va)
      |     ^~~
Bob.cpp:67:27: error: 'ed' was not declared in this scope; did you mean 'ld'?
   67 |             if (cnt == 1) ed.pb(i);
      |                           ^~
      |                           ld
Bob.cpp:71:22: error: request for member 'size' in 'adj.std::vector<int>::operator[](((std::vector<int>::size_type)edge.std::vector<int>::operator[](0)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   71 |     if (adj[edge[0]].size() > adj[edge[1]].size()) bit[1] = edge[0];
      |                      ^~~~
Bob.cpp:71:44: error: request for member 'size' in 'adj.std::vector<int>::operator[](((std::vector<int>::size_type)edge.std::vector<int>::operator[](1)))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'}
   71 |     if (adj[edge[0]].size() > adj[edge[1]].size()) bit[1] = edge[0];
      |                                            ^~~~