제출 #778533

#제출 시각아이디문제언어결과실행 시간메모리
778533Mouad_ouj메기 농장 (IOI22_fish)C++17
0 / 100
19 ms5716 KiB
#include "fish.h"//sub3 #include <bits/stdc++.h> using namespace std; long long max_weights(int n, int m,vector<int> b,vector<int> y,vector<int> w) { long long tab[n]={0},dp[n][4]={0}; for(int a=0;a<m;a++) tab[b[a]]=w[a]; dp[0][0]=0;dp[0][1]=0; dp[0][2]=tab[0];dp[0][3]=0; dp[1][0]=0;dp[1][0]=tab[1]; dp[1][2]=tab[0];dp[1][3]=0; for(int x=2;x<n;x++) { dp[x][0]=max(dp[x-1][0],dp[x-1][1]); dp[x][1]=max(dp[x-1][3]+tab[x],dp[x-1][2]+tab[x]); dp[x][2]=max(dp[x-1][1],dp[x-1][0]); dp[x][3]=max(dp[x-1][3],dp[x-1][2]); } long long ans=max(max(dp[n-1][0],dp[n-1][1]),max(dp[n-1][2],dp[n-1][3])); 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...