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>
#define endl "\n"
using namespace std;
const int maxn = 1024;
vector<int>g[maxn];
int findSample(int n, int confidence[], int host[], int protocol[])
{
for(int i = 1; i < n; i++)
{
if(protocol[i]==0)
{
g[host[i]].push_back(i);
g[i].push_back(host[i]);
}
if(protocol[i]==1)
{
for(int nb : g[host[i]])
{
g[nb].push_back(i);
g[i].push_back(nb);
}
}
if(protocol[i]==2)
{
g[host[i]].push_back(i);
g[i].push_back(host[i]);
for(int nb : g[host[i]])
{
g[nb].push_back(i);
g[i].push_back(nb);
}
}
}
int ans = 0;
for(int mask = 1; mask < (1<<n); mask++)
{
int ch = 0;
for(int j = 0; j < n; j++) if(mask&(1<<j)) ch += confidence[j];
bool f = true;
for(int j = 0; j < n; j++)
{
if(!(mask&(1<<j))) continue;
for(int nb : g[j]) if(mask&(1<<nb)) f = false;
}
if(f) ans = max(ans,ch);
}
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... |