답안 #201984

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
201984 2020-02-13T01:35:58 Z Segtree Cats or Dogs (JOI18_catdog) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include"catdog.h"
using namespace std;
typedef int ll;
typedef vector<int> vll;
#define chmax(a,b) a=max(a,b)
#define chmin(a,b) a=min(a,b)
#define all(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod
ll N;
vector<ll> g[1010];
ll dp[1010][2],col[1010];
void dfs(ll x,ll from){
    rep(k,2)dp[x][k]=1e9;
    if(col[x]!=1)dp[x][0]=0;
    if(col[x]!=0)dp[x][1]=0;
    for(auto y:g[x])if(y!=from){
	dfs(y,x);
	dp[x][0]+=min(dp[y][0],dp[y][1]+1);
	dp[x][1]+=min(dp[y][0]+1,dp[y][1]);
    }
}
ll solve(){
    dfs(1,0);
    return min(dp[1][0],dp[1][1]);
}
ll cat(int v){
    col[v]=0;
    return solve();
}
ll dog(int v){
    col[v]=1;
    return solve();
}
ll neighbor(int v){
    col[v]=2;
    return solve();
}
void initalize(ll n,vll a,vll b){
    rep(i,n-1){
	g[a[i]].push_back(b[i]);
	g[b[i]].push_back(a[i]);
    }
    for(int i=1;i<=n;i++)col[i]=2;
}
/*int main(){
    
}*/


Compilation message

/tmp/ccNOp8TQ.o: In function `main':
grader.cpp:(.text.startup+0x157): undefined reference to `initialize(int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status