이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 (z, p);
q = max (t, q);
}
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... |