#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
428 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
173 ms |
14456 KB |
Output is correct |
4 |
Correct |
175 ms |
14456 KB |
Output is correct |
5 |
Correct |
16 ms |
1292 KB |
Output is correct |
6 |
Correct |
177 ms |
14456 KB |
Output is correct |
7 |
Correct |
172 ms |
14456 KB |
Output is correct |
8 |
Correct |
166 ms |
14456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
50 ms |
512 KB |
Output is correct |
3 |
Execution timed out |
3099 ms |
14456 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
428 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
173 ms |
14456 KB |
Output is correct |
4 |
Correct |
175 ms |
14456 KB |
Output is correct |
5 |
Correct |
16 ms |
1292 KB |
Output is correct |
6 |
Correct |
177 ms |
14456 KB |
Output is correct |
7 |
Correct |
172 ms |
14456 KB |
Output is correct |
8 |
Correct |
166 ms |
14456 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
50 ms |
512 KB |
Output is correct |
11 |
Execution timed out |
3099 ms |
14456 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |