Submission #627471

#TimeUsernameProblemLanguageResultExecution timeMemory
627471Trisanu_DasCatfish Farm (IOI22_fish)C++17
6 / 100
102 ms8804 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; #define ll long long int ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { vector<ll> pref0(N+1), pref1(N+1); for (int i = 0; i < M; i++) { if (X[i] == 0) pref0[Y[i] + 1] += W[i]; else pref1[Y[i] + 1] += W[i]; } for (int i = 1; i <= N; i++) { pref0[i] += pref0[i-1]; pref1[i] += pref1[i-1]; } ll s1 = 0, s2 = 0, s3 = 0; for (int i = 0; i <= N; i++) { s1 = max(s1, pref1[i]); s2 = max(s2, pref0[i]); s3 = max(s3, pref1[N] - pref1[i] + pref0[i]); } if (N == 2) return max(s1, s2); return max(s1, max(s2, s3)); }
#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...