제출 #385931

#제출 시각아이디문제언어결과실행 시간메모리
385931alireza_kaviani친구 (IOI14_friend)C++11
35 / 100
2 ms492 KiB
#include <bits/stdc++.h> #include "friend.h" using namespace std; typedef pair<int, int> pii; #define X first #define Y second #define all(x) (x).begin() , (x).end() #define SZ(x) int(x.size()) const int MAXN = 1e5 + 10; const int MOD = 1e9 + 7; int dp[2][MAXN]; int findSample(int n,int confidence[],int host[],int protocol[]){ for(int i = 0 ; i < n ; i++){ dp[1][i] = confidence[i]; } for(int i = n - 1 ; i > 0 ; i--){ if(protocol[i] == 0){ dp[1][host[i]] += dp[0][i]; dp[0][host[i]] += max(dp[0][i] , dp[1][i]); } if(protocol[i] == 1){ dp[0][host[i]] += dp[0][i]; dp[1][host[i]] += max(dp[0][i] , dp[1][i]); } if(protocol[i] == 2){ dp[0][host[i]] = max(dp[0][host[i]] , dp[0][i]); dp[1][host[i]] = max(dp[1][host[i]] , dp[1][i]); } } return max(dp[0][0] , dp[1][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...