Submission #1061434

#TimeUsernameProblemLanguageResultExecution timeMemory
1061434MarwenElarbiCatfish Farm (IOI22_fish)C++17
9 / 100
35 ms7872 KiB
#include <bits/stdc++.h> #include "fish.h" using namespace std; #define pb push_back #define ll long long #define fi first #define se second long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { int n=N;int m=M; long long dp[n][2][2]; memset(dp,0,sizeof dp); vector<int> tab(n,0); for (int i = 0; i < m; ++i) { tab[X[i]]=W[i]; } dp[0][0][1]=tab[0]; for (int i = 1; i < n; ++i) { dp[i][0][0]=dp[i-1][1][0]+tab[i]; if(i<n-1) dp[i][0][1]=dp[i-1][0][0]+tab[i]; dp[i][1][0]=max({dp[i-1][1][0],dp[i-1][0][0],dp[i-1][0][1]}); } return max(dp[n-1][1][0],dp[n-1][0][0]); }
#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...