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>
#define pb push_back
#define ll long long
#define pll pair<ll,ll>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
vector<vector<ll>> fish(2,vector<ll>(N,0));
ll i;
for(i=0;i<M;i++){
fish[X[i]][Y[i]]=W[i];
}
vector<vector<ll>> pre(2,vector<ll>(N,0));
ll md=0;
md=max(md,fish[0][0]-fish[1][0]);
pre[0][0]=fish[0][0];
pre[1][0]=fish[1][0];
for(i=1;i<N;i++){
pre[0][i]=pre[0][i-1]+fish[0][i];
pre[1][i]=pre[1][i-1]+fish[1][i];
md=max(md,pre[0][i]-pre[1][i]);
}
return pre[1][N-1]+md;
}
# | 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... |