Submission #173873

#TimeUsernameProblemLanguageResultExecution timeMemory
173873CaroLindaFriend (IOI14_friend)C++14
100 / 100
38 ms2808 KiB
#include "friend.h" #include <bits/stdc++.h> #define debug printf #define lp(i,a,b) for(int i = a ; i < b ; i++ ) #define ff first #define ss second #define pb push_back #define mk make_pair #define ll long long #define sz size() #define pii pair<int,int> #define all(x) x.begin(),x.end() #define tiii tuple<int,int,int> #define mkt make_tuple const int MAXN = 1e5+10 ; using namespace std ; int dontGet[MAXN] ; int findSample(int n,int get[],int host[],int protocol[]) { for(int i = n-1 ; i > 0 ; i-- ) { protocol[i] ++ ; if( protocol[i] == 1 ) { get[ host[i] ] += dontGet[i] ; dontGet[ host[i] ] += max(get[i], dontGet[i] ) ; } else if( protocol[i] == 2 ) { get[ host[i] ] = max(get[host[i]] , dontGet[host[i]]) + max( get[i] , dontGet[i] ) ; dontGet[ host[i] ] += dontGet[i] ; } else if( protocol[i] == 3 ) { get[host[i]] = max( get[host[i]] + dontGet[i] , get[i] + dontGet[host[i]] ) ; dontGet[ host[i] ] += dontGet[i] ; } } return max(get[0] , dontGet[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...