Submission #1064079

#TimeUsernameProblemLanguageResultExecution timeMemory
1064079VMaksimoski008Friend (IOI14_friend)C++17
11 / 100
1034 ms3932 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int mat[10][10]; int findSample(int n, int confidence[], int host[], int protocol[]) { int ans=0; for(int i=1; i<n; i++) { if(protocol[i] == 0) { mat[host[i]][i] = mat[i][host[i]] = 1; } else if(protocol[i] == 1) { for(int j=0; j<n; j++) if(mat[host[i]][j]) mat[i][j] = mat[j][i] = 1; } else { mat[host[i]][i] = mat[i][host[i]] = 1; for(int j=0; j<n; j++) if(mat[host[i]][j]) mat[i][j] = mat[j][i] = 1; } } for(int s=0; s<(1<<n); s++) { bool ok = 1; vector<int> vec; for(int i=0; i<n; i++) { if(s & (1 << i)) { for(int &x : vec) if(mat[x][i]) ok = 0; vec.push_back(i); } } if(ok) { int sum = 0; for(int &x : vec) sum += confidence[x]; 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...