Submission #210206

#TimeUsernameProblemLanguageResultExecution timeMemory
210206mohamedsobhi777Friend (IOI14_friend)C++14
100 / 100
42 ms2808 KiB
#include<bits/stdc++.h> #include<friend.h> using namespace std ; const int N = 1e5 + 5 ; int findSample(int n , int confidence[] , int host[] , int protocol[]){ int sol[n+1]; for(int i = 0 ; i < n; i++) sol[i] = confidence[i] ; int ret = 0 ; for(int i = n-1 ; i>0 ; i--){ int p = protocol[i] ; if(!p){ ret+=sol[i] ; sol[host[i]] = max(0 , sol[host[i]] - sol[i]) ; } else if(p==1){ sol[host[i]] +=sol[i] ; } else{ sol[host[i]] = max(sol[host[i]] ,sol[i]) ; } } return sol[0] + ret ; }
#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...