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 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 < N; 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 = 0;
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 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... |