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 <bits/stdc++.h>
#include "friend.h"
using namespace std;
#define vt vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for(int (i) = 0; (i) < (x); (i)++ )
typedef long long ll;
typedef long double ld;
typedef vt<int> vi;
typedef pair<int,int> pii;
bool arr[20][20];
int findSample(int n, int confidence[], int host[], int protocol[]){
int x = 1<<n;
for(int i = 1; i < n; i++){
if(protocol[i]==0){
arr[i][host[i]] = true;
arr[host[i]][i] = true;
}else if(protocol[i]==1){
for(int j = 0; j < i; j++){
if(arr[j][host[i]]){
arr[i][j] = true;
arr[j][i] = true;
}
}
}else{
for(int j = 0; j < i; j++){
if(arr[j][host[i]]||j==host[i]){
arr[i][j] = true;
arr[j][i] = true;
}
}
}
}
int ans = 0;
for(int i = 0; i < x; i++){
vt<bool> cur(n);
for(int j = 0; j < n; j++){
cur[j] = (1<<j)&i;
}
int curans = 0;
bool bol = true;
for(int j = 0; j < n; j++){
if(cur[j])curans+=confidence[j];
for(int k = 0; k < n; k++){
if(cur[j]&&cur[k]&&arr[j][k]){
bol = false;
}
}
}
if(bol)ans = max(ans,curans);
}
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... |