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>
using namespace std;
int findSample(int n, int confidence[], int host[], int protocol[]){
bool v[10][10];
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
v[i][j] = 0;
}
}
for(int i = 0; i < 10; i++)v[i][i] = 1;
for(int i = 1; i < n; i++){
int h = host[i];
if(protocol[i] == 0){
v[h][i] = v[i][h] = 1;
} else if(protocol[i] == 2){ // We
for(int j = 0; j < n; j++){
if(v[h][j]) v[i][j] = v[j][i] = 1;
}
} else { //MyFriends
for(int j = 0; j < n; j++){
if(j != h && v[h][j]) v[i][j] = v[j][i] = 1;
}
}
}
int r = 0;
for(int i = 0; i < (1<<n); i++){
int c = 0;
for(int j = 0; j < n; j++){
if(i & (1<<j))c += confidence[j];
}
bool b = 1;
for(int j = 0; j < n; j++){
for(int k = 0; k < n; k++){
if(j != k && (i &(1<<j)) && (i &(1<<k)) && v[j][k])
b = 0;
}
}
if(b)r = max(r, c);
}
return r;
}
# | 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... |