제출 #874048

#제출 시각아이디문제언어결과실행 시간메모리
874048Sandarach151친구 (IOI14_friend)C++17
11 / 100
335 ms65536 KiB
#include<bits/stdc++.h> using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]){ set<int> adg[n]; for(int i=1; i<n; i++){ if(protocol[i]==0){ adg[host[i]].insert(i); adg[i].insert(host[i]); } else if(protocol[i]==1){ for(auto u : adg[host[i]]){ adg[i].insert(u); adg[u].insert(i); } } else{ for(auto u : adg[host[i]]){ adg[i].insert(u); adg[u].insert(i); } adg[host[i]].insert(i); adg[i].insert(host[i]); } } if(n<=10){ int maxx = 0; for(int mask=0; mask < (1<<n); mask++){ bool test = true; int cur = 0; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(((mask & (1<<i))!=0) && ((mask & (1<<j))!=0) && adg[i].count(j)){ test = false; break; } } if(!test){ break; } } if(test){ for(int i=0; i<n; i++){ if((mask & (1<<i))!=0){ cur+=confidence[i]; } } maxx = max(maxx, cur); } } return maxx; } }

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

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:53:1: warning: control reaches end of non-void function [-Wreturn-type]
   53 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...