Submission #404193

#TimeUsernameProblemLanguageResultExecution timeMemory
404193Kenzo_1114Friend (IOI14_friend)C++17
8 / 100
2 ms332 KiB
#include<bits/stdc++.h> #include"friend.h" using namespace std; const int MAXN = 100010; int n, c[MAXN], h[MAXN], p[MAXN]; /* 0 : IAmYourFriend 1 : MyFriendsAreYourFriends 2 : WeAreYourFriends */ int color[MAXN]; int task5() { for(int i = 1; i < n; i++) { int a = h[i]; int b = i; if(p[i] == 0) color[b] = !color[a]; else color[b] = color[a]; } int ans[2] = {0, 0}; for(int i = 0; i < n; i++) ans[color[i]] += c[i]; return max(ans[0], ans[1]); } int findSample(int N, int Confidence[], int Host[], int Protocol[]) { n = N; for(int i = 0; i < N; i++) c[i] = Confidence[i]; for(int i = 0; i < N; i++) h[i] = Host[i]; for(int i = 0; i < N; i++) p[i] = Protocol[i]; return task5(); }
#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...