이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "squad.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> a,d,p;
void Init(std::vector<int> A, std::vector<int> D, std::vector<int> P){
a = A;
d = D;
p = P;
}
pair<ll, ll> ad[2], bd[2];
long long BestSquad(int X, int Y){
int n = a.size();
for(int i=0;i<n;i++) {
pair<ll,ll> ta = {1LL*X*a[i] + 1LL*Y*p[i], i};
if(ta > ad[0]) {
ad[1] = ad[0];
ad[0] = ta;
} else if (ta > ad[1]) {
ad[1] = ta;
}
pair<ll,ll> tb = {1LL*X*d[i] + 1LL*Y*p[i], i};
if (tb > bd[0]) {
bd[1] = bd[0];
bd[0] = tb;
} else if (tb > bd[1]) {
bd[1] = tb;
}
}
if (ad[0].second != bd[0].second) {
return ad[0].first + bd[0].first;
} else {
return max(ad[0].first + bd[1].first, ad[1].first+bd[0].first);
}
}
/*
void Init(std::vector<int> A, std::vector<int> D, std::vector<int> P){
int N = A.size();
}
long long BestSquad(int X, int Y){
return 0;
}
*/
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |