이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 < 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] == 1){ // 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... |