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 "squad.h"
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
int n;
vi a, d, p;
void Init(std::vector<int> xA, std::vector<int> xD, std::vector<int> xP){
n = xA.size();
for(auto i : xA) a.pb(i);
for(auto i : xD) d.pb(i);
for(auto i : xP) p.pb(i);
}
long long BestSquad(int X, int Y){
ll atc, def, ans = 0;
atc = def = 0;
for(int i = 0; i < n; i++) {
ans = max(ans, X*1ll*a[i] + Y*1ll*p[i] + def);
ans = max(ans, X*1ll*d[i] + Y*1ll*p[i] + atc);
atc = max(atc, X*1ll*a[i] + Y*1ll*p[i]);
def = max(def, X*1ll*d[i] + Y*1ll*p[i]);
}
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... |