이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "squad.h"
#include <vector>
#include <algorithm>
using namespace std;
int N;
vector<int> A;
vector<int> D;
vector<int> P;
void Init(std::vector<int> AA, std::vector<int> DD, std::vector<int> PP){
N = AA.size();
A = AA;
D = DD;
P = PP;
return;
}
long long BestSquad(int X, int Y){
vector<pair<long long, int>> x;
vector<pair<long long, int>> y;
for(int i=0; i<N; i++){
x.push_back({-1LL*A[i]*X-1LL*P[i]*Y, i});
y.push_back({-1LL*D[i]*X-1LL*P[i]*Y, i});
}
sort(x.begin(), x.end());
sort(y.begin(), y.end());
long long res = 0;
for(int i=0; i<2; i++){
for(int j=0; j<2; j++){
if(x[i].second == y[j].second) continue;
res = max(res, -x[i].first-y[j].first);
}
}
return res;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |