Submission #785094

#TimeUsernameProblemLanguageResultExecution timeMemory
785094khshgCatfish Farm (IOI22_fish)C++17
0 / 100
22 ms3924 KiB
#include<bits/stdc++.h> using namespace std; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { long long ans = 0; vector<int> c(N); for(int i = 0; i < M; ++i) { c[X[i]] = W[i]; } vector<array<long long, 2>> dp(N); dp[0][0] = 0; dp[0][1] = c[0]; for(int i = 1; i < N; ++i) { dp[i][0] = max(dp[i - 1][0], dp[i - 1][1]); dp[i][1] = dp[i - 1][0] + c[i]; } return max(dp.back()[0], dp.back()[1]); }

Compilation message (stderr)

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:5:12: warning: unused variable 'ans' [-Wunused-variable]
    5 |  long long ans = 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...