Submission #1079143

#TimeUsernameProblemLanguageResultExecution timeMemory
1079143ArthuroWichCatfish Farm (IOI22_fish)C++17
0 / 100
26 ms20124 KiB
#include "fish.h" #include<bits/stdc++.h> using namespace std; #define int long long int int max_weights(int32_t N, int32_t M, vector<int32_t> X, vector<int32_t> Y, vector<int32_t> W) { int n = N, m = M; vector<vector<int>> c(1, vector<int>(n+1, 0)); vector<vector<int>> dp(9, vector<int>(n+1, 0)); for (int i = 0; i < m; i++) { c[Y[i]][X[i]] = W[i]; } for (int j = 0; j < n; j++) { if (j-1 >= 0) { dp[0][j] = max(dp[0][j], dp[0][j-1]+c[0][j]); dp[0][j] = max(dp[0][j], dp[0][j-1]); dp[1][j] = max(dp[1][j], dp[1][j-1]); } if (j == 1) { dp[1][j] = max(dp[1][j], dp[0][j-1]+c[0][j-1]); } if (j-2 >= 0) { dp[1][j] = max(dp[1][j], dp[0][j-2]+c[0][j-1]); dp[1][j] = max(dp[1][j], dp[1][j-2]+c[0][j-1]); } } return max(dp[0][n-1], dp[1][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...