제출 #1184624

#제출 시각아이디문제언어결과실행 시간메모리
1184624pensive친구 (IOI14_friend)C++20
100 / 100
16 ms2120 KiB
#include "friend.h" #include <iostream> #include <algorithm> #include <vector> #include <algorithm> using namespace std; #define ll long long #define REP(a,i,n) for (int i=a;i<n;i++) #define f first #define s second void memoing(int h, int i, int act, pair<int,int> memo[]) { if (act == 0) { memo[h].s = memo[h].s + memo[i].f; memo[h].f = max(memo[h].f + memo[i].s, memo[h].f + memo[i].f); } else if (act == 1) { memo[h].s = max({memo[h].s + memo[i].s, memo[h].s + memo[i].f, memo[h].f + memo[i].s}); memo[h].f = memo[h].f + memo[i].f; } else if (act == 2) { memo[h].s = max(memo[h].s + memo[i].f, memo[h].f + memo[i].s); memo[h].f = memo[h].f + memo[i].f; } } int findSample(int N, int confidence[], int host[], int protocol[]) { pair<int,int> memo[N+5]; REP(0,i,N) { memo[i].f = 0; memo[i].s=confidence[i]; } for(int i=N-1;i>0;i--) { memoing(host[i], i, protocol[i], memo); } return max(memo[0].f, memo[0].s); }
#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...