이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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>;
#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, pf[2][MX];
ll max_weights(int n, int m, vi x, vi y, vi w) {
pf[0][0] = pf[1][0] = 0;
fri(i,0,n) {
pf[0][i+1] = pf[0][i] + (x[i]==0);
pf[1][i+1] = pf[1][i] + (x[i]==1);
}
res = max(pf[0][n], pf[1][n]);
fri(i,1,n) {
maxs(res, pf[0][i] + pf[1][n] - 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... |