Submission #721376

#TimeUsernameProblemLanguageResultExecution timeMemory
721376bLICCatfish Farm (IOI22_fish)C++17
3 / 100
116 ms10132 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { ll sum[N]{}; for (int i = 0;i<M;i++){ sum[X[i]]+=W[i]; } ll dp[N+1][2]; memset(dp, 0, sizeof(dp)); for (int i = 1;i<=N;i++){ dp[i][0] = max(dp[i-1][1], dp[i-1][0]); dp[i][1] = dp[i-1][0]+sum[i-1]; } return max(dp[N][0], dp[N][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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...