제출 #589224

#제출 시각아이디문제언어결과실행 시간메모리
589224FatihSolak친구 (IOI14_friend)C++17
컴파일 에러
0 ms0 KiB
#include "friend.h" #include <bits/stdc++.h> #define N 1005 using namespace std; vector<int> adj[N]; // Find out best sample long long findSample(int n,int confidence[],int host[],int protocol[]){ int SUBTASK = 1; set<int> s; for(int i = 1;i<n;i++){ s.insert(protocol[i]); } if(n > 10 && s.size() == 2){ SUBTASK = 5; } if(s.size() == 1){ if(*s.begin() == 0){ SUBTASK = 4; } if(*s.begin() == 1){ SUBTASK = 2; } if(*s.begin() == 2){ SUBTASK = 3; } } if(SUBTASK == 1){ for(int i = 1;i<n;i++){ if(protocol[i] == 0){ adj[i].push_back(host[i]); adj[host[i]].push_back(i); } if(protocol[i] == 1){ for(auto u:adj[host[i]]){ adj[i].push_back(u); adj[u].push_back(i); } } if(protocol[i] == 2){ for(auto u:adj[host[i]]){ adj[i].push_back(u); adj[u].push_back(i); } adj[i].push_back(host[i]); adj[host[i]].push_back(i); } } long long ans = 0; for(int mask = 1;mask < (1<<n);mask++){ long long sum = 0; bool ok = 1; for(int i = 0;i<n;i++){ if(mask & (1<<i)){ sum += confidence[i]; for(auto u:adj[i]){ if(mask & ( 1<<u)) ok = 0; } } } if(ok){ ans = max(ans,sum); } } return ans; } return 0; }

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

friend.cpp:7:11: error: ambiguating new declaration of 'long long int findSample(int, int*, int*, int*)'
    7 | long long findSample(int n,int confidence[],int host[],int protocol[]){
      |           ^~~~~~~~~~
In file included from friend.cpp:1:
friend.h:7:5: note: old declaration 'int findSample(int, int*, int*, int*)'
    7 | int findSample(int n,int confidence[],int host[],int protocol[]);
      |     ^~~~~~~~~~