Submission #874087

#TimeUsernameProblemLanguageResultExecution timeMemory
874087teacupFriend (IOI14_friend)C++14
16 / 100
1 ms348 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n,int confidence[],int host[],int protocol[]){ int ans=0; if (protocol[1]==1) { for (int a=0; a<=n; a++) ans+=confidence[a]; } else if (protocol[1]==2) { for (int a=0; a<=n; a++) ans=max(ans, confidence[a]); } else { int bi[n+5]; memset(bi, -1, sizeof(bi)); bi[0]=0; for (int a=1; a<=n; a++) { if (bi[host[a]]==0) bi[a]=1; else bi[a]=0; } int total=0; for (int a=0; a<=n; a++) { total+=confidence[a]; if (bi[a]==1) ans+=confidence[a]; } ans=max(ans, total-ans); } 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...