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"//sub2
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int n, int m,vector<int> x,vector<int> y,vector<int> w)
{
long long tab1[n]={0},tab2[n]={0};
for(int a=0;a<m;a++)
{
if(x[a]==0)
tab1[y[a]]+=w[a];
else
tab2[y[a]]+=w[a];
}
for(int a=1;a<n;a++)
{
tab1[a]+=tab1[a-1];
tab2[a]+=tab2[a-1];
}
long long ans=max(tab1[n-1],tab2[n-1]);
for(int a=0;a<n;a++)
{
ans=max(ans,tab1[a]+tab2[n-1]-tab2[a]);
}
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... |