제출 #749923

#제출 시각아이디문제언어결과실행 시간메모리
749923Abrar_Al_Samit친구 (IOI14_friend)C++17
0 / 100
1062 ms316 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int g[10][10]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=1; i<n; ++i) { if(protocol[i]==0) { g[host[i]][i] = g[i][host[i]] = 1; } else if(protocol[i]==1) { for(int j=0; j<n; ++j) if(g[host[i]][j]) { g[i][j] = g[j][i] = 1; } } else { g[host[i]][i] = g[i][host[i]] = 1; for(int j=0; j<n; ++j) if(g[host[i]][j]) { g[i][j] = g[j][i] = 1; } } } int ans = 0; for(int mask=1; mask<(1<<n); ++mask) { bool valid = true; for(int i=0; i<n; ++i) { for(int j=0; j<n; ++j) { if(g[i][j]) valid = false; } } if(!valid) continue; int cur = 0; for(int j=0; j<n; ++j) if(mask>>j&1) { cur += confidence[j]; } ans = max(ans, cur); } return ans; }
#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...