Submission #902908

#TimeUsernameProblemLanguageResultExecution timeMemory
902908Faisal_SaqibFriend (IOI14_friend)C++17
0 / 100
1 ms616 KiB
#include "friend.h" #include <vector> using namespace std; bool adj[11][11]; vector<int> ma[11]; int findSample(int n,int c[],int h[],int p[]) { for(int i=1;i<n;i++) { if(p[i]==0) { ma[h[i]].push_back(i); } else if(p[i]==1) { for(int jk:ma[h[i]]) ma[jk].push_back(i); } else { for(int jk:ma[h[i]]) ma[jk].push_back(i); ma[h[i]].push_back(i); } } for(int i=0;i<n;i++) for(int j:ma[i]) adj[j][i]=adj[i][j]=1; int ans=0; for(int mask=0;mask<(1ll<<n);mask++) { int sum=0; vector<int> jp; for(int j=0;j<n;j++) { if(mask&(1<<j)) { sum+=c[j]; jp.push_back(j); } } bool pos=1; for(int i:jp) { for(int j:jp) { if(adj[i][j]) pos=0; } } if(pos) ans=max(ans,sum); } 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...