Submission #778544

#TimeUsernameProblemLanguageResultExecution timeMemory
778544Mouad_oujCatfish Farm (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]; for(int x=0;x<n;x++) { for(int a=0;a<4;a++) dp[x][a]=0; } for(int a=0;a<m;a++) tab[b[a]]=w[a]; dp[1][0]=0; dp[1][1]=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...