Submission #784021

#TimeUsernameProblemLanguageResultExecution timeMemory
784021SoulKnightCatfish Farm (IOI22_fish)C++17
0 / 100
42 ms4760 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ln '\n' long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { int a[N+3]; memset(a, 0, sizeof(a)); ll res = 0LL; for (int i = 0; i < M; i++){ a[X[i]+3] = W[i]; res += W[i]; } int dp[N+3]; memset(dp, 0, sizeof(dp)); for (int i = 0+3; i < N+3; i++){ dp[i] = max(dp[i-1], max( a[i-1] + dp[i-2], a[i] + a[i-2] + dp[i-3])); // cout << dp[i] << ln; } // cout << dp[N+2] << ln; return dp[N+2]; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...