Submission #624359

#TimeUsernameProblemLanguageResultExecution timeMemory
624359yuto1115Friend (IOI14_friend)C++17
100 / 100
28 ms3356 KiB
#include "friend.h" #include <bits/stdc++.h> #define rep(i, n) for(ll i = 0; i < ll(n); ++i) #define rep2(i, s, n) for(ll i = ll(s); i < ll(n); ++i) #define rrep(i, n) for(ll i = ll(n) - 1; i >= 0; --i) #define rrep2(i, n, t) for(ll i = ll(n) - 1; i >= ll(t); --i) #define pb push_back #define eb emplace_back #define SZ(a) int(a.size()) #define all(a) a.begin(), a.end() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vp = vector<P>; using vvp = vector<vp>; using vb = vector<bool>; using vvb = vector<vb>; using vs = vector<string>; const int inf = 1001001001; const ll linf = 1001001001001001001; template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } // Find out best sample int findSample(int n, int confidence[], int host[], int protocol[]) { vi p(n), q(n); rep(i, n) p[i] = confidence[i]; rrep2(i, n, 1) { int h = host[i]; if (protocol[i] == 0) { p[h] += q[i]; q[h] += max(p[i], q[i]); } else if (protocol[i] == 1) { p[h] = max({p[h] + p[i], p[h] + q[i], q[h] + p[i]}); q[h] += q[i]; } else { p[h] = max(p[h] + q[i], q[h] + p[i]); q[h] += 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...