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 <iostream>
#include <vector>
#include <set>
using namespace std;
vector<set<int>> friends;
int findSample(int n,int confidence[],int host[],int protocol[]){
int type[3] = {0,0,0};
for(int i = 0;i<n;i++){
type[protocol[i]] ++;
if(protocol[i] == 0){
friends[host[i]].insert(i+1);
friends[i+1].insert(host[i]);
}else if(protocol[i] == 1){
for(int a:friends[host[i]]){
friends[i+1].insert(a);
friends[a].insert(i+1);
}
}else{
friends[host[i]].insert(i+1);
friends[i+1].insert(host[i]);
for(int a:friends[host[i]]){
friends[i+1].insert(a);
friends[a].insert(i+1);
}
}
}
for(int i = 0;i<=n;i++)if(friends[i].count(i))friends[i].erase(i);
if(type[0] == 0 && type[2] == 0){
int ans = 0;
for(int i = 0;i<=n;i++)ans += confidence[i];
return ans;
}
if(type[0] == 0 && type[1] == 0){
int ans = 0;
for(int i = 0;i<=n;i++)ans = max(confidence[i],ans);
return ans;
}
// if(n<=10){
// for()
// }
return -1;
}
# | 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... |