Submission #521028

#TimeUsernameProblemLanguageResultExecution timeMemory
521028FulopMateFriend (IOI14_friend)C++17
11 / 100
1090 ms3908 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]){ bool v[10][10]; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ v[i][j] = 0; } } for(int i = 0; i < 10; i++)v[i][i] = 1; for(int i = 1; i < n; i++){ int h = host[i]; if(protocol[i] == 0){ v[h][i] = v[i][h] = 1; } else if(protocol[i] == 2){ // We for(int j = 0; j < n; j++){ if(v[h][j]) v[i][j] = v[j][i] = 1; } } else { //MyFriends for(int j = 0; j < n; j++){ if(j != h && v[h][j]) v[i][j] = v[j][i] = 1; } } } int r = 0; for(int i = 0; i < (1<<n); i++){ int c = 0; for(int j = 0; j < n; j++){ if(i & (1<<j))c += confidence[j]; } bool b = 1; for(int j = 0; j < n; j++){ for(int k = 0; k < n; k++){ if(j != k && (i &(1<<j)) && (i &(1<<k)) && v[j][k]) b = 0; } } if(b)r = max(r, c); } return r; }
#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...