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 pb push_back
#define mk make_pair
#define sc second
#define fr first
using namespace std;
const int N = (1e6 + 5);
int u[1005][1005];
int ans;
int fg;
vector <int> g[N];
int findSample(int n,int confidence[],int host[],int protocol[]){
if (n <= 10) {
for (int i = 1; i < n; i ++) {
int v = host[i];
if (protocol[i] == 0) {
u[v][i] = 1,u[i][v] = 1;
g[v].pb(i),g[i].pb(v);
}
else if (protocol[i] == 1) {
for (auto to : g[v]) {
g[to].pb(i),g[i].pb(to);
u[to][i] = 1,u[i][to] = 1;
}
}
else {
for (auto to : g[v]) {
g[to].pb(i),g[i].pb(to);
u[to][i] = 1,u[i][to] = 1;
}
g[v].pb(i);
g[i].pb(v);
u[v][i] = 1;
u[i][v] = 1;
}
}
for (int i = 0; i < (1 << n); i ++) {
vector <int> v;
int fl = 0;
int as = 0;
for (int j = 0; j < n; j ++) {
if (i & (1 << j)) {
for (auto to : v)
if (u[to][j]) fl = 1;
as += confidence[j];
v.pb(j);
}
}
if (!fl)
ans = max(ans,as);
}
return ans;
}
else {
for (int i = 0; i < n; i ++)
ans += confidence[i];
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... |