#include "squad.h"
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define FOR(i,a,b) for(int i=a;i<b;i++)
vii ps;
vi p;
vi a;
int n;
void Init(std::vector<int> A, std::vector<int> D, std::vector<int> P){
int N = A.size();
n = N;
FOR(i,0,N) a.push_back(A[i]);
FOR(i,0,N) p.push_back(P[i]);
FOR(i,0,N) ps.push_back(ii(P[i], i));
sort(ps.begin(), ps.end());
}
long long BestSquad(int X, int Y){
int best=0;
for(int i=0;i<n;i++){
int cu = a[i]*X + p[i]*Y;
int ind = ps.size()-1;
while(ps[ind].S==i) ind--;
cu+=ps[ind].F*Y;
//cout<<i<<" "<<ps[ind].S<<" "<<cu<<endl;
best =max(best, cu);
}
//cout<<"---------\n";
return best;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |