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;
int g[10][10];
int findSample(int n,int confidence[],int host[],int protocol[]){
for(int i=1; i<n; ++i) {
if(protocol[i]==0) {
g[host[i]][i] = g[i][host[i]] = 1;
} else if(protocol[i]==1) {
for(int j=0; j<n; ++j) if(g[host[i]][j]) {
g[i][j] = g[j][i] = 1;
}
} else {
g[host[i]][i] = g[i][host[i]] = 1;
for(int j=0; j<n; ++j) if(g[host[i]][j]) {
g[i][j] = g[j][i] = 1;
}
}
}
int ans = 0;
for(int mask=1; mask<(1<<n); ++mask) {
bool valid = true;
for(int i=0; i<n; ++i) {
for(int j=0; j<n; ++j) {
if(g[i][j]) valid = false;
}
}
if(!valid) continue;
int cur = 0;
for(int j=0; j<n; ++j) if(mask>>j&1) {
cur += confidence[j];
}
ans = max(ans, cur);
}
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... |