제출 #1064799

#제출 시각아이디문제언어결과실행 시간메모리
1064799NemanjaSo2005친구 (IOI14_friend)C++17
0 / 100
2 ms5464 KiB
#include "friend.h" #include<bits/stdc++.h> #define ll long long using namespace std; const int maxn=1e5+5; int N,niz[maxn],kol[maxn]; bool prosli[maxn]; ll res=0; vector<int> graf[maxn]; void grana(int a,int b){ graf[a].push_back(b); graf[b].push_back(a); } void dfs(int gde,int boja){ kol[boja]++; boja^=1; prosli[gde]=true; for(int x:graf[gde]) if(!prosli[x]) dfs(x,boja); return; } int findSample(int n,int confidence[],int host[],int protocol[]){ N=n; for(int i=1;i<=N;i++) niz[i]=confidence[i-1]; for(int i=1;i<N;i++){ int x=host[i]+1; int p=protocol[i]; if(p==1 or p==2){ for(int aa:graf[x]) grana(aa,i+1); } if(p==0 or p==2) grana(x,i+1); } dfs(1,1); return max(kol[0],kol[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...