제출 #154506

#제출 시각아이디문제언어결과실행 시간메모리
154506kostia244Organizing the Best Squad (FXCUP4_squad)C++17
19 / 100
3027 ms27008 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...