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 <bits/stdc++.h>
#include "fish.h"
#define tcT template<class T
#define fastio ios::sync_with_stdio(false);cin.tie(nullptr);
#define ln '\n'
#define nwln cout<<ln;
using namespace std;
tcT> using vr = vector<T>;
using ll = long long;
using vi = vr<int>;
using vl = vr<ll>;
using vvl = vr<vl>;
#define fri(i,a,b) for(int i=(a); i<(b); ++i)
#define each(x, a) for(auto& x: a)
#define maxs(i, j) (i = max(i, j))
const int MX = (int) 3e5+3;
ll res;
vvl pf;
ll max_weights(int n, int m, vi x, vi y, vi w) {
pf.assign(2, vl(n, 0));
fri(i,0,m) pf[x[i]][y[i]] = w[i];
fri(i,1,n) {
fri(j,0,2) pf[j][i] += pf[j][i-1];
}
res = pf[1][n-1];
fri(i,0,n) {
maxs(res, pf[0][i] + pf[1][n-1] - pf[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... |