Submission #1130658

#TimeUsernameProblemLanguageResultExecution timeMemory
1130658vibeduckCatfish Farm (IOI22_fish)C++20
0 / 100
19 ms2880 KiB
#include "fish.h" #include <vector> #include <bits/stdc++.h> using namespace std; //#define int long long long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { // y[i] = 0 vector<int> dp(N); vector<int> a(N, 0); for (int i = 0; i < M; i++) a[X[i]] = W[i]; dp[0] = a[0]; dp[1] = a[1]; int ans = max(dp[0], dp[1]); for (int i = 2; i < N; i++) { dp[i] = dp[i - 1]; dp[i] = max(dp[i], dp[i - 2] + a[i]); dp[i] = max(dp[i], dp[i - 1] - a[i - 1] + a[i]); ans = max(ans, dp[i]); } return ans; }
#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...