Submission #629072

#TimeUsernameProblemLanguageResultExecution timeMemory
629072Justin1Catfish Farm (IOI22_fish)C++17
6 / 100
86 ms8824 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll ps1[100005], ps2[100005]; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { for (int i = 0; i < M; i++) { if (X[i] == 0) ps1[Y[i]] += W[i]; else ps2[Y[i]] += W[i]; } for (int i = 1; i < N; i++) ps1[i] += ps1[i-1]; for (int i = N-1; i >= 0; i--) ps2[i] += ps2[i+1]; if (N == 2) { return max(ps1[N-1], ps2[0]); } ll ans = ps2[0]; for (int i = 0; i < N; i++) ans = max(ans,ps1[i] + ps2[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...