제출 #53357

#제출 시각아이디문제언어결과실행 시간메모리
53357zetapi친구 (IOI14_friend)C++14
11 / 100
37 ms4744 KiB
#include "friend.h" #include "bits/stdc++.h" using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator const int MAX=1e5; int maps[100][100]; int findSample(int n,int confidence[],int host[],int protocol[]) { vector<int> lol,vec[100]; int ans=0,ok,N=n,cur; for(int A=1;A<N;A++) { if(protocol[A]==0) { vec[host[A]].pb(A); vec[A].pb(host[A]); } else if(protocol[A]==1) { for(auto B:vec[host[A]]) { vec[B].pb(A); vec[A].pb(B); } } else { for(auto B:vec[host[A]]) { vec[B].pb(A); vec[A].pb(B); } vec[host[A]].pb(A); vec[A].pb(host[A]); } } for(int A=0;A<N;A++) for(auto B:vec[A]) maps[A][B]=1; for(int A=0;A<(1<<N);A++) { ok=1; cur=0; lol.clear(); for(int B=0;B<N;B++) { if(A&(1<<B)) lol.pb(B),cur+=confidence[B]; } for(auto A:lol) for(auto B:lol) if(maps[A][B]==1) ok=0; if(ok) ans=max(ans,cur); } return ans; } /*int main() { ios_base::sync_with_stdio(false); int n= cout<<findSample() return 0; }*/
#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...