Submission #1074560

#TimeUsernameProblemLanguageResultExecution timeMemory
1074560mindiyakFriend (IOI14_friend)C++14
8 / 100
108 ms32396 KiB
#include "friend.h" #include <iostream> #include <vector> #include <set> using namespace std; vector<set<int>> friends(1005); int findSample(int n,int confidence[],int host[],int protocol[]){ int type[3] = {0,0,0}; for(int i = 0;i<n;i++){ if (i == 0)continue; 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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...