Submission #629078

#TimeUsernameProblemLanguageResultExecution timeMemory
629078kwongwengCatfish Farm (IOI22_fish)C++17
0 / 100
23 ms4308 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; #define FOR(i,a,b) for(int i = a; i < b; i++) ll max_weights(int N, int M, vi X, vi Y, vi W) { vector<ll> A(N); FOR(i,0,M){ A[X[i]] = W[i]; } ll dp[N][2]; memset(dp,0,sizeof(dp)); if (N>1){ dp[1][0] = A[1]; dp[1][1] = A[0]; } FOR(i,2,N){ dp[i][0] = dp[i-1][1] + A[i]; dp[i][1] = max(dp[i-1][0], dp[i-2][0] + A[i-1]); } return max(dp[N-1][0], dp[N-1][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...