Submission #433008

#TimeUsernameProblemLanguageResultExecution timeMemory
433008REALITYNBFriend (IOI14_friend)C++17
0 / 100
305 ms3912 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define F first #define S second #define mp make_pair #include "friend.h" using namespace std; const int N = 15; int adj[N][N] ; int findSample(int n , int* v, int* p , int* protocol ){ vector<int> add[n] ; for(int i=1;i<n;i++){ if(protocol[i]==0||protocol[i]==2){ add[p[i]].push_back(i) ; add[i].push_back(p[i]) ; } if(protocol[i]>0){ for(int x : add[p[i]]){ add[x].push_back(i); add[i].push_back(x); } } } for(int i=0;i<n;i++) for(int x: add[i]) adj[i][x]=adj[x][i]=1; int ans = 0 ; for(int i=0;i<(1<<n);i++){ bool flg = 0 ; for(int j=0;j<n;j++){ if((1<<j)&i){ for(int k=0;k<n;k++){ if(k==j) continue ; if((1<<k)&i){ if(add[k][j]) flg = 1 ; } } } } if(flg) continue ; int res = 0 ; for(int j=0;j<n;j++) if((1<<j)&i) res+=v[j] ; ans=max(ans,res) ; } 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...