제출 #313473

#제출 시각아이디문제언어결과실행 시간메모리
313473juggernaut친구 (IOI14_friend)C++14
27 / 100
38 ms1528 KiB
#include"friend.h" //#include"grader.cpp" #include<bits/stdc++.h> using namespace std; vector<int>g[15]; bool can[15][15]; void add(int x,int y){ g[x].push_back(y); g[y].push_back(x); } int findSample(int n,int confidence[],int host[],int protocol[]){ if(n<11){ int i; for(i=1;i<n;i++){ if(protocol[i]==0){ add(host[i],i); }else if(protocol[i]==1){ for(int to:g[host[i]])add(i,to); }else if(protocol[i]==2){ for(int to:g[host[i]])add(i,to); add(host[i],i); } } for(int i=0;i<n;i++)for(int to:g[i])can[i][to]=1,can[to][i]=1; int mx=0,sum; for(int mask=0;mask<(1<<n);mask++){ sum=0; for(int i=0;i<n;i++) if(mask>>i&1){ sum+=confidence[i]; for(int j=0;j<n;j++)if((mask>>j&1)&&can[i][j])sum=-2e9; } mx=max(mx,sum); } return mx; }else{ int i,cnt[3]={0,0,0}; for(i=1;i<n;i++) cnt[protocol[i]]++; if(cnt[1]==n-1){ int sum=0; for(int i=0;i<n;i++)sum+=confidence[i]; return sum; }else{ int sum=0; for(int i=0;i<n;i++)sum=max(sum,confidence[i]); return sum; } } }
#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...