답안 #573528

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
573528 2022-06-06T18:57:16 Z MadokaMagicaFan 항공 노선도 (JOI18_airline) C++14
컴파일 오류
0 ms 0 KB
#include "Alicelib.h"
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
const ll inf = 1e9;
const int md1 = 1e9+7;
const int md2 = 998244353;

#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(), v.rend()
#define sz(v)                       ((int)v.size())

#define forn(i,n)                   for(int i = 0; i < n; ++i)
#define forbe(i,b,e)                for(int i = b; i < e; ++i)

#define pb                          push_back

#define pry                         puts("YES")
#define prn                         puts("NO")
#define endl                        '\n'

#define fst                         first
#define scn                         second

const int N = 1e3;

vector<int> adj[N+12];

void InitG(int v, int u);
void MakeG(int pos, int c, int d);

void
addadj(int a, int b)
{
    adj[a].pb(b);
    adj[b].pb(a);
    return;
}

void
Alice(int n, int m, vector<int> a, vector<int> b)
{
    for (int i = 0; i < m; ++i)
        addadj(a[i],b[i]);

    for (int i = 0; i < 9; ++i)
        addadj(n+i,n+i+1);

    for (int i = 0; i < 10; ++i)
        addadj(n+10,n+i);

    for (int i = 0; i < n+10; ++i)
        addadj(n+11,i);

    for (int i = 0; i < n; ++i)
        for (int j = 0; j < 10; ++j)
            if (i&(1<<j))
                addadj(i, n+j);

    int u = 0;
    for (int i = 0; i < n+13; ++i)
        u += sz(adj[i]);
    u >>= 1;

    InitG(n+12,u);
    u = 0;

    for (int i = 0; i < n+13; ++i) {
        for (int x : adj[i]) {
            if (x > i) continue;
            assert(x!=i);
            MakeG(u,i,x);
            ++u;
        }
    }
}
#include "Boblib.h"
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
const ll inf = 1e9;
const int md1 = 1e9+7;
const int md2 = 998244353;

#define all(v)                      v.begin(), v.end()
#define rall(v)                     v.rbegin(), v.rend()
#define sz(v)                       ((int)v.size())

#define forn(i,n)                   for(int i = 0; i < n; ++i)
#define forbe(i,b,e)                for(int i = b; i < e; ++i)

#define pb                          push_back

#define pry                         puts("YES")
#define prn                         puts("NO")
#define endl                        '\n'

#define fst                         first
#define scn                         second

const int N = 1e3;

vector<int> adj[N+12];

void
addadj(int a, int b)
{
    adj[a].pb(b);
    adj[b].pb(a);
    return;
}

void InitMap(int n, int m);
void MakeMap(int a, int b);

void
Bob(int v, int u, vector<int> c, vector<int> d)
{
    int n = v-12;
    if (n==1) {
        InitMap(1,0);
        return;
    }

    for (int i = 0; i < n; ++i)
        adj[i].clear();

    for (int i = 0; i < u; ++i) {
        addadj(c[i],d[i]);
    }

    int endnode = -1;
    int beginnode = -1;

    bitset<N+12> special;

    for (int i = 0; i < v; ++i)
        special[i] = 1;

    for (int i = 0; i < v; ++i) {
        if (sz(adj[i]) == v-2)
            endnode = 0;
    }

    special[endnode] = 0;

    for (int x : adj[endnode])
        special[x] = 0;

    for (int i = 0; i < v; ++i)
        if(special[i])
            beginnode = i;

    special[beginnode] = 0;

    for (int x : adj[beginnode])
        special[x] = 1;

    vector<int> realval(v,0);

    vector<int> sval;
    for (int i = 0; i < v; ++i) {
        if (!special[i]) continue;
        int deg = 0;
        for (int x : adj[i]) {
            if (!special[x]) continue;
            ++deg;
        }
        if (deg==1)
            sval.pb(i);
    }

    int start = 0;

    assert(sz(sval)==2);
    if (sz(adj[sval[0]]) > sz(adj[sval[1]]))
        start = sval[1];
    else
        start = sval[0];


    int z = 9;
    while (1) {
        int nxt = -1;
        special[start]=0;
        for (int x : adj[start]) {
            if (special[x]) nxt=x;
            realval[x] += (1<<z);
        }
        if (nxt==-1) break;
        --z;
        start = nxt;
    }


    for (int x : adj[beginnode])
        special[x] = 1;
    special[endnode] = 1;
    special[beginnode] = 1;

    int m = 0;

    for (int i = 0; i < v; ++i) {
        if (special[i]) continue;
        for (int x : adj[i]) {
            if (!special[x])
                ++m;
        }
    }

    InitMap(n,m>>1);

    for (int i = 0; i < v; ++i) {
        if (special[i]) continue;
        for (int x : adj[i]) {
            if (special[i]) continue;
            if (x > i) continue;
            MakeMap(realval[i], realval[x]);
        }
    }


    return;
}

Compilation message

/usr/bin/ld: /tmp/ccM8t8DZ.o: in function `main':
grader_alice.cpp:(.text.startup+0xa2): undefined reference to `Alice(int, int, int*, int*)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccJfdirI.o: in function `main':
grader_bob.cpp:(.text.startup+0xb2): undefined reference to `Bob(int, int, int*, int*)'
collect2: error: ld returned 1 exit status