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 findSample(int n, int v[], int pa[], int ty[])
{
vector<vector<bool> > vg(n, vector<bool>(n, 0));
int i, j, k, s, ms = 0;
for (i = 1; i < n; i++)
{
k = pa[i];
if (ty[i] != 1)
vg[i][k] = vg[k][i] = 1;
if (ty[i])
{
for (j = 0; j < i; j++)
{
if (vg[j][k])
vg[i][j] = vg[j][i] = 1;
}
}
}
for (i = 0; i < (1 << n); i++)
{
s = 0;
for (j = 0; j < n; j++)
{
if (i & (1 << j))
s += v[j];
}
for (j = 0; j < n; j++)
{
for (k = 0; k < n; k++)
{
if ((i & (1 << j)) && (i & (1 << k)) && vg[j][k])
s = 0;
}
}
ms = max(ms, s);
}
return ms;
}
# | 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... |