이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "friend.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 1003;
int n;
int a[N];
bool g[N][N];
vector<int> f[N];
int findSample(int n_, int confidence[],int host[],int protocol[]){
n = n_;
for (int i = 0; i < n; ++i) {
a[i] = confidence[i];
}
for (int i = 1; i < n; ++i) {
if (protocol[i] == 0) {
g[host[i]][i] = true;
g[i][host[i]] = true;
f[host[i]].push_back(i);
f[i].push_back(host[i]);
}
else {
for (int j : f[host[i]]) {
g[j][i] = true;
g[i][j] = true;
f[j].push_back(i);
f[i].push_back(j);
}
if (protocol[i] == 2) {
g[i][host[i]] = true;
g[host[i]][i] = true;
f[host[i]].push_back(i);
f[i].push_back(host[i]);
}
}
}
int ans = 0;
for (int i = 0; i < (1 << n); ++i) {
int tmp = 0;
for (int j = 0; j < n; ++j) {
if (!(i >> j & 1)) {
continue;
}
tmp += a[j];
for (int k = j + 1; k < n; ++k) {
if (!(i >> k & 1)) {
continue;
}
if (g[j][k]) {
tmp = -INT_MAX;
break;
}
}
}
ans = max(ans, tmp);
}
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... |