Submission #550053

#TimeUsernameProblemLanguageResultExecution timeMemory
550053CSQ31Friend (IOI14_friend)C++17
100 / 100
29 ms3408 KiB
#include "friend.h" #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef vector<vector<int>> vii; #define pb push_back #define sz(a) (int)(a.size()) int p[100000],q[100000]; int findSample(int n,int confidence[],int h[],int protocol[]){ for(int i=0;i<n;i++)p[i] = confidence[i]; for(int i=n-1;i>0;i--){ if(protocol[i] == 0){ p[h[i]] = p[h[i]] + q[i]; q[h[i]] = q[h[i]] + max(p[i],q[i]); }else if(protocol[i] == 1){ p[h[i]] = max(p[h[i]] + max(p[i],q[i]) , p[i] + q[h[i]]); q[h[i]] = q[h[i]] + q[i]; }else{ p[h[i]] = max(p[h[i]] + q[i],p[i] + q[h[i]]); q[h[i]] = q[h[i]] + 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...