#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
171 ms |
14456 KB |
Output is correct |
4 |
Incorrect |
181 ms |
14456 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
171 ms |
14456 KB |
Output is correct |
4 |
Incorrect |
181 ms |
14456 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |