Submission #935841

#TimeUsernameProblemLanguageResultExecution timeMemory
935841StavabCatfish Farm (IOI22_fish)C++17
0 / 100
19 ms7772 KiB
#include "fish.h" #include <vector> #include <algorithm> using namespace std; struct fish { int x, y, w; bool operator<(const fish &f) { return x < f.x; } }; vector<fish> v; long long dp[300005][2]; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { v.push_back({-1, -1, -1}); for(int i = 0; i < M; i++) v.push_back({X[i], Y[i], W[i]}); sort(v.begin(), v.end()); dp[0][0] = 0; dp[0][1] = 0; for(int i = 1; i <= M; i++) { dp[i][0] = v[i].w + dp[i - 1][1]; dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]); } return max(dp[M][0], dp[M][1]); }
#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...