Submission #836645

#TimeUsernameProblemLanguageResultExecution timeMemory
836645Abrar_Al_SamitCatfish Farm (IOI22_fish)C++17
6 / 100
82 ms14672 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; const int nax = 100000; long long fish[2][nax]; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { for(int i=0; i<M; ++i) { fish[X[i]][Y[i]] = W[i]; } for(int i=1; i<N; ++i) { fish[0][i] += fish[0][i-1]; } for(int i=N-2; i>=0; --i) { fish[1][i] += fish[1][i+1]; } long long ans = max(fish[0][N-1], fish[1][0]); if(N==2) return ans; for(int i=1; i<N; ++i) { ans = max(ans, fish[1][i] + fish[0][i-1]); } 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...