This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |