답안 #1054465

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1054465 2024-08-12T10:05:38 Z Kipras 자매 도시 (APIO20_swap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
//#include "swap.h"

const ll maxN = 1e5+10;
const ll inf = 1e10;

ll par[maxN], timeP[maxN], cycle[maxN], sz[maxN];
ll n, m;
vector<ll> adj[maxN];
vector<pair<ll, pair<ll, ll>>> edges;

ll find(ll node, ll t) {
    if(par[node]==node)return node;
    if(timeP[node]<=t) {
        return find(par[node], t);
    }
    return node;
}

void unite(ll a, ll b, ll t, bool is){
    a = find(a, t);
    b = find(b, t);
    if(a==b){
        cycle[a]=min(cycle[a], t);
        cycle[b]=min(cycle[b], t);
        return;
    }
    if(sz[a]>sz[b]) {
        swap(a, b);
    }

    if(cycle[a]==0&&cycle[b]!=0)
        cycle[a]=cycle[b];
    else if(cycle[b]==0&&cycle[a]!=0)
        cycle[b]=cycle[a];

    if(is) {
        if(cycle[a]==0)cycle[a]=t;
        if(cycle[b]==0)cycle[b]=t;
    }

    sz[b]+=sz[a];
    par[a]=b;
    timeP[a]=t;
}


/*

5 6
0 0 1 1 1 2
1 2 2 3 4 3
4 4 1 2 10 3
3
1 2
2 4
0 1


*/

Compilation message

/usr/bin/ld: /tmp/ccXSQcu2.o: in function `main':
grader.cpp:(.text.startup+0x1c3): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: grader.cpp:(.text.startup+0x217): undefined reference to `getMinimumFuelCapacity(int, int)'
collect2: error: ld returned 1 exit status