Submission #29650

#TimeUsernameProblemLanguageResultExecution timeMemory
29650cki86201Friend (IOI14_friend)C++11
100 / 100
53 ms4364 KiB
#include "friend.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <math.h> #include <assert.h> #include <queue> #include <map> #include <set> #include <string> #include <algorithm> #include <iostream> #include <functional> #include <unordered_map> #include <unordered_set> #include <list> #include <bitset> using namespace std; typedef pair<int, int> pii; typedef long long ll; #define Fi first #define Se second #define pb(x) push_back(x) #define sz(x) ((int)(x).size()) #define rep(i, n) for(int i=0;i<n;i++) #define all(x) (x).begin(), (x).end() typedef tuple<int, int, int> t3; typedef pair<ll, ll> Pll; typedef long double ldouble; int par[100010]; int D[100010][2]; int findSample(int n,int confidence[],int host[],int protocol[]){ rep(i, n) D[i][0] = 0, D[i][1] = confidence[i]; for(int i=n-1;i;i--) { int h = host[i], c = protocol[i]; if(c == 0) D[h][0] += max(D[i][0], D[i][1]), D[h][1] += D[i][0]; else if(c == 1) { D[h][1] = max(D[h][1] + max(D[i][0], D[i][1]), D[h][0] + D[i][1]); D[h][0] += D[i][0]; } else if(c == 2) { D[h][1] = max(D[h][0] + D[i][1], D[h][1] + D[i][0]); D[h][0] += D[i][0]; } } return max(D[0][0], D[0][1]); }
#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...