This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |