Submission #1015421

#TimeUsernameProblemLanguageResultExecution timeMemory
1015421parsadox2Friend (IOI14_friend)C++17
11 / 100
1100 ms2336 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int n , ar[N] , adj[N] , dp[(1 << 11)]; int findSample(int nn,int confidence[],int host[],int protocol[]){ n = nn; for(int i = 0 ; i < n ; i++) ar[i] = confidence[i]; for(int i = 1 ; i < n ; i++) { if(protocol[i] != 0) { for(int j = 0 ; j < n ; j++) if((adj[host[i]] >> j) & 1) { adj[i] |= (1 << j); adj[j] |= (1 << i); } } if(protocol[i] != 1) { adj[i] |= (1 << host[i]); adj[host[i]] |= (1 << i); } } for(int mask = (1 << n) - 1 ; mask >= 0 ; mask--) { for(int i = 0 ; i < n ; i++) { int tmp = (adj[i] | (1 << i)); if((mask & tmp) == 0) dp[mask] = max(dp[mask] , dp[(mask | (1 << i))] + ar[i]); } } return dp[0]; }
#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...