Submission #422491

#TimeUsernameProblemLanguageResultExecution timeMemory
422491Andyvanh1Friend (IOI14_friend)C++14
11 / 100
1080 ms3948 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; #define vt vector #define pb push_back #define all(x) (x).begin(),(x).end() #define rep(i,x) for(int (i) = 0; (i) < (x); (i)++ ) typedef long long ll; typedef long double ld; typedef vt<int> vi; typedef pair<int,int> pii; bool arr[20][20]; int findSample(int n, int confidence[], int host[], int protocol[]){ int x = 1<<n; for(int i = 1; i < n; i++){ if(protocol[i]==0){ arr[i][host[i]] = true; arr[host[i]][i] = true; }else if(protocol[i]==1){ for(int j = 0; j < i; j++){ if(arr[j][host[i]]){ arr[i][j] = true; arr[j][i] = true; } } }else{ for(int j = 0; j < i; j++){ if(arr[j][host[i]]||j==host[i]){ arr[i][j] = true; arr[j][i] = true; } } } } int ans = 0; for(int i = 0; i < x; i++){ vt<bool> cur(n); for(int j = 0; j < n; j++){ cur[j] = (1<<j)&i; } int curans = 0; bool bol = true; for(int j = 0; j < n; j++){ if(cur[j])curans+=confidence[j]; for(int k = 0; k < n; k++){ if(cur[j]&&cur[k]&&arr[j][k]){ bol = false; } } } if(bol)ans = max(ans,curans); } 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...