Submission #1080170

#TimeUsernameProblemLanguageResultExecution timeMemory
1080170juicyFriend (IOI14_friend)C++17
100 / 100
34 ms3912 KiB
// https://github.com/tmwilliamlin168/CompetitiveProgramming/blob/master/IOI/14-Friend.cpp #include "friend.h" #include <bits/stdc++.h> using namespace std; int findSample(int n, int *c, int *h, int *p){ vector dp(2, vector<int>(n)); dp[1] = vector<int>(c, c + n); while (--n) { if (!p[n]) { dp[0][h[n]] += dp[1][n]; dp[1][h[n]] += dp[0][n]; } else if (p[n] == 1) { dp[0][h[n]] += dp[0][n]; dp[1][h[n]] += dp[1][n]; } else { dp[1][h[n]] = max(dp[0][n] + dp[1][h[n]], dp[1][n] + dp[0][h[n]]); dp[0][h[n]] += dp[0][n]; } dp[1][h[n]] = max(dp[1][h[n]], dp[0][h[n]]); } return 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...