제출 #1190050

#제출 시각아이디문제언어결과실행 시간메모리
1190050Amr메기 농장 (IOI22_fish)C++20
0 / 100
12 ms2368 KiB
#include "fish.h" #include <vector> #include<bits/stdc++.h> typedef long long ll; using namespace std; #define sz size() const int N2 = 302, M2 = 10; ll a[N2][M2], pre[N2][M2]; ll dp[N2][M2]; ll inf = 1e18; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { for(int i = 0; i < M; i++) { ll x = X[i]+1, y = Y[i]+1; a[x][y] = W[i]; } for(int i = 1; i < N2; i++) { for(int j = 1; j < M2; j++) pre[i][j] = pre[i][j-1] + a[i][j]; } for(int i = 1; i < M2; i++) dp[0][i] = -inf; for(int i = 0; i < M2; i++) dp[1][i] = 0; for(int i = 2; i < N2; i++) { dp[i][0] = dp[i-1][0]; for(int j = 1; j < M2; j++) dp[i][0] = max(dp[i][0],dp[i-1][j]+pre[i][j]); //for(int j = 1; j < M2; j++) dp[i][0] = max(dp[i][0], dp[i-2][j]+pre[i-1][j]); for(int j = 1; j < M2; j++) { for(int k = 0; k < M2; k++) for(int l = 0; l < M2; l++) { ll how2 = max(j,l); ll how1 = min(how2,(ll)k); ll me2 = k, me1 = min(me2,(ll)j); dp[i][j] = max(dp[i][j], dp[i-2][l]+ pre[i-1][how2]-pre[i-1][how1] + pre[i][me2]-pre[i][me1] ); } } } //for(int i = 1; i <= N+1; i++) {for(int j = 0; j < 6; j++) cout << dp[i][j] << " "; cout << endl;} ll mx = 0; for(int i = 0; i < M2; i++) mx = max(mx, dp[N][i]); return mx; }
#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...