Submission #173811

#TimeUsernameProblemLanguageResultExecution timeMemory
173811CaroLindaFriend (IOI14_friend)C++14
16 / 100
38 ms3232 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] ] += get[i] ; } else if( protocol[i] == 2 ) { if( get[i] <= dontGet[i] ) { get[ host[i] ] += dontGet[i] ; dontGet[ host[i] ] += dontGet[i] ; } else { if( get[ host[i] ] <= dontGet[ host[i] ] ) { get[ host[i] ] = get[i] + dontGet[ host[i] ]; dontGet[ host[i] ] += dontGet[i] ; } else { get[ host[i] ] += get[i] ; dontGet[ host[i] ] += dontGet[i] ; } } } else if( protocol[i] == 3 ) { dontGet[ host[i] ] += dontGet[i] ; if( get[host[i]] >= get[i] ) get[host[i]] += dontGet[i] ; else get[host[i]] = get[i] + dontGet[host[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...