제출 #57651

#제출 시각아이디문제언어결과실행 시간메모리
57651FLDutchman친구 (IOI14_friend)C++14
컴파일 에러
0 ms0 KiB
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define int long long
#define MMAX 16384
#define fast_io() ios::sync_with_stdio(false)
#define FOR(i, l, r) for(int i = (l); i < (r); i++)

typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef set<int> si;
typedef double ld;
typedef pair<ld, ld> dd;

const ll INF = 1000000000000000000LL;
const int NMAX = 1100;
const int mod = 1e9+7;
const ld eps = 1e-10;
const ld PI = acos(-1);


vi match;
bitset<NMAX> vis;
vi adj[NMAX];

int aug(int n){
    if(vis[n]) return 0;
    vis[n] = 1;
    for(int k : adj[n]) if(match[k] == -1 || aug(match[k])) {
        match[k] = n;
        match[n] = k;
        return 1;
    }
    return 0;
}

int MCBM(){
    int tot = 0;
    FOR(i, 0, NMAX) if(match[i] == -1) vis.reset(), tot += aug(i);
    return tot;
}


int findSample(int n, int confidence[], int host[], int protocol[]){
    FOR(i, 1, n){
        if(protocol[i] == 0 || protocol[i] == 2){
            adj[host[i]].pb(i);
            adj[i].pb(host[i]);
            //cout << i << " " << host[i] << endl;
        }
        if(protocol[i] == 1 || protocol[i] == 2){
            for(int k : adj[host[i]]){
                //cout << i << " " << k << endl;
                adj[k].pb(i);
                adj[i].pb(k);
            }
        }
    }
    match.assign(NMAX, -1);
    //cout<<endl;
    int m = MCBM();
    /*FOR(i, 0, n){
        cout << i << " " << match[i] << endl;
    }*/
    return n - m;
}


/*
signed main(){
    fast_io();
    int N;
    int conf[NMAX], host[NMAX], protocol[NMAX];
    cin >> N;
    FOR(i, 0, N) cin >> conf[i];
    FOR(i, 1, N) cin >> host[i], cin >> protocol[i];
    cout << findSample(N, conf, host, protocol);
    
}*/ 

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccLDfr86.o: In function `main':
grader.cpp:(.text.startup+0xba): undefined reference to `findSample(int, int*, int*, int*)'
collect2: error: ld returned 1 exit status