제출 #150468

#제출 시각아이디문제언어결과실행 시간메모리
150468graneli (#200)Organizing the Best Squad (FXCUP4_squad)C++17
0 / 100
181 ms14456 KiB
#include "squad.h" #define F first #define S second #define mp make_pair #define pb push_back //#define ll __int128 #define ll long long #define LEFT(a) ((a)<<1) #define RIGHT(a) (LEFT(a) + 1) #define MID(a,b) ((a+b)>>1) #define MAX(a,b) ((a)>(b)?(a):(b)) #define MIN(a,b) ((a)<(b)?(a):(b)) #define y1 y122 using namespace std; const int N = 300005; int n; ll A[N], B[N], P[N]; void Init(std::vector<int> Aa, std::vector<int> Dd, std::vector<int> Pp){ n = Aa.size(); for (int i = 1; i <= n; i++){ A[i] = Aa[i - 1]; B[i] = Dd[i - 1]; P[i] = Pp[i - 1]; } } long long BestSquad(int X, int Y){ ll x = X, y = Y; ll p = 0, q = 0; ll ans = 0; for (int i = 1; i <= n; i++){ ll z = x * A[i] + y * P[i]; ll t = x * B[i] + y * P[i]; ll pas = max (z + q, t + p); ans = max (ans, pas); p = max (t, p); q = max (t, q); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...