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;
const int nax = 100000;
long long fish[2][nax];
long long max_weights(int N, int M, vector<int> X, vector<int> Y,
vector<int> W) {
for(int i=0; i<M; ++i) {
fish[X[i]][Y[i]] = W[i];
}
for(int i=1; i<N; ++i) {
fish[0][i] += fish[0][i-1];
}
for(int i=N-2; i>=0; --i) {
fish[1][i] += fish[1][i+1];
}
long long ans = max(fish[0][N-1], fish[1][0]);
if(N==2) return ans;
for(int i=1; i<N; ++i) {
ans = max(ans, fish[1][i] + fish[0][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... |