Submission #288466

#TimeUsernameProblemLanguageResultExecution timeMemory
288466Atill83Friend (IOI14_friend)C++14
11 / 100
1046 ms3960 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; // Find out best sample int adj[15][15]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 1; i < n; i++){ if(protocol[i] == 0){ adj[host[i]][i] = 1; adj[i][host[i]] = 1; }else if(protocol[i] == 1){ for(int j = 0; j < n; j++){ if(j == i) continue; if(adj[j][host[i]]){ adj[i][j] = adj[j][i] = 1; } } }else{ for(int j = 0; j < n; j++){ if(adj[j][host[i]] || j == host[i]){ adj[i][j] = adj[j][i] = 1; } } } } long long ans = 0; for(int i = 0; i < (1<<n); i++){ long long sim = 0; for(int j = 0; j < n; j++){ if((1<<j) & i){ sim += confidence[j]; for(int k = j + 1; k < n; k++){ if((1<<k) & i){ if(adj[j][k]) sim = -1e18; } } } } ans = max(ans, sim); } 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...