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<bits/stdc++.h>
#include "friend.h"
using namespace std;
int findSample(int n, int confidence[], int host[], int protocol[]){
int ans = 0;
vector<vector<int>> g(n);
for(int i=1; i<n; ++i) {
if(protocol[i]!=1) {
g[i].push_back(host[i]);
g[host[i]].push_back(i);
}
if(protocol[i]!=0) {
for(int j: g[host[i]]) {
g[i].push_back(j);
g[j].push_back(i);
}
}
}
for(int mask=0; mask<(1<<n); ++mask) {
vector<bool> on(n);
int sum = 0;
for(int i=0; i<n; ++i) {
if(mask&(1<<i)) {
on[i] = 1;
sum += confidence[i];
}
}
for(int i=0; i<n; ++i) {
if(on[i]) {
for(int j: g[i]) {
if(on[j]) sum = -1;
}
}
}
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... |