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 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 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... |