Submission #778522

#TimeUsernameProblemLanguageResultExecution timeMemory
778522Mouad_oujCatfish Farm (IOI22_fish)C++17
0 / 100
20 ms7008 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]=tab[0];dp[0][1]=tab[0]; dp[0][2]=tab[0];dp[0][3]=tab[0]; for(int x=1;x<n;x++) { dp[x][0]=max(dp[x-1][0],dp[x-1][1]+tab[x-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]+tab[x-1]); 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...