Submission #227962

# Submission time Handle Problem Language Result Execution time Memory
227962 2020-04-29T11:18:16 Z urd05 Friend (IOI14_friend) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

int n;
int co[100000];
int host[100000];
int pro[100000];
int con[10][10];

int findSample(int nn,int conf[],int hos[],int prot[]) {
    n=nn;
    for(int i=0;i<n;i++) {
        co[i]=conf[i];
        host[i]=hos[i];
        pro[i]=prot[i];
    }
    for(int i=1;i<n;i++) {
        if (pro[i]==0) {
            con[host[i]][i]=1;
            con[i][host[i]]=1;
        }
        if (pro[i]==1) {
            for(int j=0;j<n;j++) {
                if (con[host[i]][j]==1) {
                    con[i][j]=1;
                    con[j][i]=1;
                }
            }
        }
        if (pro[i]==2) {
            for(int j=0;j<n;j++) {
                if (con[host[i]][j]==1) {
                    con[i][j]=1;
                    con[j][i]=1;
                }
            }
            con[host[i]][i]=1;
            con[i][host[i]]=1;
        }
    }
    int ret=0;
    for(int i=0;i<(1<<n);i++) {
        bool use[10];
        memset(use,0,sizeof(use));
        for(int j=0;j<n;j++) {
            if ((i&(1<<j))!=0) {
                use[j]=true;
            }
        }
        bool flag=true;
        for(int j=0;j<n;j++) {
            for(int k=0;k<n;k++) {
                if (con[k][j]==1&&use[k]&&use[j]) {
                    flag=false;
                    break;
                }
            }
        }
        if (!flag) {
            continue;
        }
        int val=0;
        for(int j=0;j<n;j++) {
            if (use[j]) {
                val+=co[j];
            }
        }
        ret=max(ret,val);
    }
    return ret;
}

Compilation message

/tmp/ccEpejDV.o:(.bss+0x61aa0): multiple definition of `host'
/tmp/ccqd4UeV.o:(.bss+0x61c20): first defined here
/usr/bin/ld: Warning: size of symbol `host' changed from 400000 in /tmp/ccqd4UeV.o to 400008 in /tmp/ccEpejDV.o
collect2: error: ld returned 1 exit status