#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 time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
181 ms |
26896 KB |
Output is correct |
4 |
Correct |
181 ms |
26840 KB |
Output is correct |
5 |
Correct |
14 ms |
2036 KB |
Output is correct |
6 |
Correct |
181 ms |
26940 KB |
Output is correct |
7 |
Correct |
181 ms |
26892 KB |
Output is correct |
8 |
Correct |
182 ms |
27008 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
25 ms |
636 KB |
Output is correct |
3 |
Execution timed out |
3027 ms |
24764 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
181 ms |
26896 KB |
Output is correct |
4 |
Correct |
181 ms |
26840 KB |
Output is correct |
5 |
Correct |
14 ms |
2036 KB |
Output is correct |
6 |
Correct |
181 ms |
26940 KB |
Output is correct |
7 |
Correct |
181 ms |
26892 KB |
Output is correct |
8 |
Correct |
182 ms |
27008 KB |
Output is correct |
9 |
Correct |
2 ms |
256 KB |
Output is correct |
10 |
Correct |
25 ms |
636 KB |
Output is correct |
11 |
Execution timed out |
3027 ms |
24764 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |