Submission #825813

#TimeUsernameProblemLanguageResultExecution timeMemory
825813loctildoreFriend (IOI14_friend)C++14
100 / 100
24 ms3068 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; // trans rights #define ll long long #define f first #define s second #define endl '\n' #define all(x) begin(x), end(x) #define MOD 1000000009 int p[100069], q[100069]; int findSample(int n, int confidence[], int host[], int protocol[]) { for (int i = 0; i < n; i++) p[i] = confidence[i]; for (int i = n - 1; i; i--) { int x = host[i]; if (!protocol[i]) { p[x] += q[i]; q[x] += max(p[i], q[i]); } else { if (protocol[i] == 1) { p[x] = max(p[x] + p[i], max(p[x] + q[i], q[x] + p[i])); } else p[x] = max(p[x] + q[i], q[x] + p[i]); q[x] += q[i]; } } return max(p[0], q[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...