제출 #697467

#제출 시각아이디문제언어결과실행 시간메모리
697467Deepesson친구 (IOI14_friend)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> #define MAX 1005 std::vector<int> con[MAX]; // Find out best sample int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i=1;i!=n;++i){ if(protocol[i]==0){ int alfa = host[i]; con[alfa].push_back(i); con[i].push_back(alfa); }else { for(auto&x:con[host[i]]){ con[i].push_back(x); con[x].push_back(i); } } } bool foi[n]={}; int cor[n]={}; int ans=0; for(int i=0;i!=n;++i){ if(foi[i])continue; std::queue<int> queue; queue.push(i); foi[i]=true; int alfa=1,beta=0; while(queue.size()){ auto __ = queue.front(); queue.pop(); for(auto&x:con[__]){ if(foi[x])continue; ///0 = alfa, 1 = beta if(cor[__])++alfa;else ++beta; cor[x]=!cor[__]; queue.push(x); foi[x]=true; } } ans+=std::max(alfa,beta); } return ans; }
#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...