제출 #586524

#제출 시각아이디문제언어결과실행 시간메모리
586524Red_Inside친구 (IOI14_friend)C++17
100 / 100
29 ms2552 KiB
#define __MAXSIZE__ 100002 #include "friend.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define forn(j, i, n) for(int i = j; i <= n; ++i) #define FOR(j, i, n) for(int i = j; i < n; ++i) #define nfor(j, i, n) for(int i = n; i >= j; --i) #define IOS ios_base::sync_with_stdio(false), cin.tie(), cout.tie(); #define all(v) v.begin(), v.end() #define pb push_back const int maxn = 2e5+100; //#define int ll #define pii pair <int, int> int inf = 1e9; int a[maxn], q[maxn], p[maxn]; int findSample(int n,int confidence[],int host[],int protocol[]) { forn(1, i, n) { a[i] = confidence[i-1]; p[i] = a[i]; q[i] = 0; } nfor(2, i, n) { int x = host[i-1] + 1; int y = i; if(protocol[i-1] == 0) { p[x] = p[x] + q[y]; q[x] = max(p[y] + q[x], q[x] + q[y]); } else if(protocol[i-1] == 1) { p[x] = max({p[x] + p[y], p[x] + q[y], q[x] + p[y]}); q[x] = q[x] + q[y]; } else { p[x] = max(p[x] + q[y], q[x] + p[y]); q[x] = q[x] + q[y]; } } return max(p[1], q[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...