이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "friend.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second
using namespace std;
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
vector<vector<int> > path(n);
for (int i = 1; i < n; i++) {
if (protocol[i] == 0) {
path[i].pb(host[i]);
path[host[i]].pb(i);
} else if (protocol[i] == 1) {
for (int con : path[host[i]]) {
path[i].pb(con);
path[con].pb(i);
}
} else {
for (int con : path[host[i]]) {
path[i].pb(con);
path[con].pb(i);
}
path[i].pb(host[i]);
path[host[i]].pb(i);
}
}
int ans = 0;
for (int state = 0; state < (1<<n); state++) {
bool pos = 1;
for (int i = 0; i < n; i++)
for (int con : path[i]) {
if ((state&(1 << i)) && (state&(1 << con)))
pos = 0;
}
if (!pos) continue;
int now = 0;
for (int i = 0; i < n; i++) {
if (state&(1<<i)) now += confidence[i];
}
ans = max(ans, now);
}
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... |