이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "friend.h"
#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define ln "\n"
#define ld long double
using namespace std;
vector<vector<int>> A;
int findSample(int n,int confidence[],int host[],int protocol[]){
A.clear(); A.resize(n);
for (int i=1; i<n; i++){
if (protocol[i]==0){
A[host[i]].push_back(i);
A[i].push_back(host[i]);
}else if (protocol[i]==2){
A[host[i]].push_back(i);
A[i].push_back(host[i]);
for (auto v:A[host[i]]){
A[v].push_back(i);
A[i].push_back(v);
}
}else{
for (auto v:A[host[i]]){
A[v].push_back(i);
A[i].push_back(v);
}
}
}
int ans=0;
for (ll i=0; i<(1<<n); i++){
bool pos=1;
for (ll j=0; j<n; j++){
if (i&(1<<j)){
for (auto v:A[j]){
if (((1<<v)&i) and v!=j) pos=0;
}
}
}
if (pos){
int res=0;
for (ll j=0; j<n; j++){
if (i&(1<<j)) {
res+=confidence[j];
}
}
ans=max(ans, res);
}
}
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... |