This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define tol(bi) (1LL<<((int)(bi)))
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
if (n<=10){
vector<vector<int>> arr(n);
for (int i = 1; i < n; i++){
if (protocol[i]==0){
arr[host[i]].push_back(i);
arr[i].push_back(host[i]);
}
else if (protocol[i]==1){
for (auto &fr : arr[host[i]]){
arr[fr].push_back(i);
arr[i].push_back(fr);
}
}
else {
for (auto &fr : arr[host[i]]){
arr[fr].push_back(i);
arr[i].push_back(fr);
}
arr[host[i]].push_back(i);
arr[i].push_back(host[i]);
}
}
int ret = 0;
for (int i = 0; i < tol(n); i++){
int cur = 0;
for (int j = 0; j < n; j++){
if (tol(j)&i){
cur+=confidence[j];
for (auto &nex : arr[j]){
if (tol(nex)&i){
cur=0;
break;
}
}
if (cur==0) break;
}
}
ret=max(ret,cur);
}
return ret;
}
return 23;
}
# | 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... |