Submission #873409

# Submission time Handle Problem Language Result Execution time Memory
873409 2023-11-15T03:35:40 Z HuyQuang_re_Zero Friend (IOI14_friend) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#define ll long long
#define db long double
#define II pair <ll,ll>
#define III pair <ll,II>
#define IV pair <vector <int>,vector <int> >
#define TII pair <treap*,treap*>
#define fst first
#define snd second
#define BIT(x,i) ((x>>i)&1)
#define pi acos(-1)
#define to_radian(x) (x*pi/180.0)
#define to_degree(x) (x*180.0/pi)
#define Log(x) (31-__builtin_clz((int)x))
#define LogLL(x) (63-__builtin_clzll((ll)x))
//#include "friend.h"
using namespace std;

int n,i,f0[100005],f1[100005],c[100005],host[100005],type[100005],u;
int findSample(int n,int c[],int host[],int type[])
{
    for(u=0;u<n;u++) f0[u]=0,f1[u]=c[u];
    for(i=n-1;i>=1;i--)
    {
        int v=i,u=host[i],k=type[i];
        if(k==0)
        {
            f1[u]+=f0[v];
            f0[u]=f0[u]+max(f0[v],f1[v]);
        }
        else if(k==1)
        {
            f1[u]=max(max(f1[u]+f0[v],f0[u]+f1[v]),f1[u]+f1[v]);
            f0[u]+=f0[v];
        }
        else
        {
            f1[u]=max(f1[u]+f0[v],f0[u]+f1[v]);
            f0[u]+=f0[v];
        }
    }
    return max(f0[0],f1[0]);
}


/*
int main()
{
    freopen("friend.inp","r",stdin);
    freopen("friend.out","w",stdout);
    cin>>n;
    for(i=0;i<n;i++) cin>>c[i];
    for(i=1;i<n;i++) cin>>host[i]>>type[i];
    cout<<findSample(n,c,host,type);
}
*/

Compilation message

/usr/bin/ld: /tmp/ccYiJRb7.o:(.bss+0x61aa0): multiple definition of `host'; /tmp/ccE0uVm9.o:(.bss+0x61ac0): first defined here
collect2: error: ld returned 1 exit status