제출 #780723

#제출 시각아이디문제언어결과실행 시간메모리
780723Mouad_ouj메기 농장 (IOI22_fish)C++17
0 / 100
146 ms70652 KiB
#include "fish.h"//sub4 #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 tab[n][9]={0},ans=0,dp[n][9][9]; for(int a=0;a<m;a++) tab[x[a]][y[a]]=w[a]; for(int a=0;a<n;a++) { for(int b=1;b<9;b++) tab[a][b]+=tab[a][b-1]; } for(int a=0;a<9;a++) { for(int b=0;b<9;b++) { if(a>b) dp[1][a][b]=tab[1][a]-tab[1][b]; else dp[1][a][b]=tab[0][b]-tab[0][a]; } } for(int c=2;c<n;c++) { for(int d=0;d<9;d++) { for(int a=0;a<9;a++) { for(int b=0;b<9;b++) { dp[c][a][b]=max(dp[c][a][b],dp[c-1][d][a]); if(a>b) dp[c][a][b]=max(dp[c-1][d][a]+tab[c][a]-tab[c][b],dp[c][a][b]); else if (b>d) dp[c][a][b]=max(dp[c-1][d][a]+tab[c-1][b]-tab[c-1][d],dp[c][a][b]); } } } } for(int a=0;a<9;a++) { for(int b=0;b<9;b++) { ans=max(ans,dp[n-1][a][b]); } } 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...