제출 #798271

#제출 시각아이디문제언어결과실행 시간메모리
798271QwertyPi친구 (IOI14_friend)C++14
100 / 100
21 ms3412 KiB
#include "friend.h" #include <bits/stdc++.h> using namespace std; struct state{ int p, q; }; state st[100011]; state f(int ptc, state s, state t){ if(ptc == 0) return {s.p + t.q, max(s.q + t.p, s.q + t.q)}; else if(ptc == 1) return {max(s.p + t.p, max(s.p + t.q, s.q + t.p)), s.q + t.q}; else return {max(s.p + t.q, s.q + t.p), s.q + t.q}; } int findSample(int n, int confidence[], int host[], int protocol[]){ for(int i = 0; i < n; i++) st[i] = {confidence[i], 0}; for(int i = n - 1; i >= 1; i--){ st[host[i]] = f(protocol[i], st[host[i]], st[i]); } return max(st[0].p, st[0].q); }
#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...