이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "friend.h"
using namespace std;
// vector<vector<int>> friendGraph;
// vector<int> value;
// vector<int> visited;
// int dfs(int v) {
// if (visited[v]) return 0;
// visited[v] = 1;
// int res = value[v];
// for (int i: friendGraph[v]) {
// res = max(res, dfs(i));
// }
// return res;
// }
// Find out best sample
int findSample(int n,int confidence[],int host[],int protocol[]){
// friendGraph.clear();
// // friendGraph.clear();
// friendGraph.resize(n);
// // friendGraph.resize(n);
// visited.assign(n, 0);
// value.assign(n, 0);
// for (int i = 0; i<n; i++) {
// value[i] = confidence[i];
// }
// vector<set<int>> friends(n);
// for (int i = 0; i<n; i++) {
// int v = host[i];
// int type = protocol[i];
// // int value = confidence[i];
// if (type == 0) {
// for (int j = 0; j<i; j++) {
// if (j == v) {
// friends[i].insert(j);
// friends[j].insert(i);
// friendGraph[j].push_back(i);
// friendGraph[i].push_back(j);
// continue;
// }
// }
// }
// if (type == 1) {
// for (int j = 0; j<i; j++) {
// if (friends[v].count(j)) {
// friends[i].insert(j);
// friends[j].insert(i);
// friendGraph[j].push_back(i);
// friendGraph[i].push_back(j);
// continue;
// }
// }
// }
// if (type == 2) {
// for (int j = 0; j<i; j++) {
// if (friends[v].count(j) || j == v) {
// friends[i].insert(j);
// friends[j].insert(i);
// friendGraph[j].push_back(i);
// friendGraph[i].push_back(j);
// continue;
// }
// }
// }
// }
// int res = 0;
// for (int i = 0; i<n; i++) {
// res += dfs(i);
// }
int res = 0;
if (protocol[0] == 1) {
for (int i = 0; i<n; i++) {
res += confidence[i];
}
}
if (protocol[0] == 2) {
for (int i = 0; i<n; i++) {
res = max(res, confidence[i]);
}
}
return res;
}
# | 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... |