Submission #749923

#TimeUsernameProblemLanguageResultExecution timeMemory
749923Abrar_Al_SamitFriend (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...