Submission #838594

#TimeUsernameProblemLanguageResultExecution timeMemory
838594AndreyCatfish Farm (IOI22_fish)C++17
0 / 100
317 ms404936 KiB
#include "fish.h" #include<bits/stdc++.h> #include <vector> using namespace std; long long haha[5000][5000]; long long dp[300][300][300]; long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y, std::vector<int> w) { for(long long i = 0; i < n; i++) { for(long long j = 0; j < n; j++) { haha[i][j] = 0; } } for(long long i = 0; i < m; i++) { haha[x[i]][y[i]+1] = w[i]; } for(long long i = 0; i < n; i++) { for(long long j = 1; j <= n; j++) { haha[i][j]+=haha[i][j-1]; } } for(long long i = 0; i <= n; i++) { for(long long j = 0; j <= n; j++) { dp[0][i][j] = 0; } } long long ans = 0; for(long long i = 1; i < n; i++) { for(long long j = 0; j <= n; j++) { for(long long k = 0; k <= n; k++) { for(long long y = 0; y <= n; y++) { long long c = dp[i-1][j][k]; if(max(j,k) < y) { c+=haha[i-1][y]-haha[i-1][max(j,k)]; } dp[i][k][y] = max(c,dp[i][k][y]); } } } } for(long long i = 0; i <= n; i++) { for(long long j = 0; j <= n; j++) { long long c = dp[n-1][i][j]; if(i > j) { c+=haha[n-1][i]-haha[n-1][j]; } ans = max(ans,dp[n-1][i][j]); } } 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...