Submission #1073278

#TimeUsernameProblemLanguageResultExecution timeMemory
1073278fv3Catfish Farm (IOI22_fish)C++17
6 / 100
62 ms24260 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { vector<vector<ll>> ps(2, vector<ll>(N)); for (int i = 0; i < M; i++) { ps[X[i]][Y[i]] = W[i]; } ll suml = 0, sumr = 0; for (int i = 0; i < N; i++) { suml += ps[0][i]; ps[0][i] = suml; sumr += ps[1][i]; ps[1][i] = sumr; } ll res = ps[1][N-1]; if (N > 2) { for (int i = 0; i < N; i++) res = max(res, ps[0][i] + ps[1][N-1] - ps[1][i]); } else { for (int i = 0; i < N; i++) res = max({res, ps[0][i], ps[1][i]}); } return res; }
#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...