| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 150752 | TLEWA맞 (#200) | 최적의 팀 구성 (FXCUP4_squad) | C++17 | 3096 ms | 11004 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "squad.h"
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
#define inf 1e18
typedef long long LL;
int n;
int a[300010], d[300010], p[300010];
void Init(std::vector<int> A, std::vector<int> D, std::vector<int> P){
n=A.size();
for(int i=0; i<n; i++){
a[i]=A[i];
d[i]=D[i];
p[i]=P[i];
}
}
long long BestSquad(int X, int Y){
LL maxx11=0, maxx21=0, maxx12=0, maxx22=0;
int maxnum1, maxnum2;
for(int i=0; i<n; i++){
if(maxx12<(LL)X*a[i]+(LL)Y*p[i]){
if(maxx11<(LL)X*a[i]+(LL)Y*p[i]){
maxx12=maxx11;
maxx11=(LL)X*a[i]+(LL)Y*p[i];
maxnum1=i;
}
else maxx12=(LL)X*a[i]+(LL)Y*p[i];
}
}
for(int i=0; i<n; i++){
if(maxx22<(LL)X*d[i]+(LL)Y*p[i]){
if(maxx21<(LL)X*d[i]+(LL)Y*p[i]){
maxx22=maxx21;
maxx21=(LL)X*d[i]+(LL)Y*p[i];
maxnum2=i;
}
else maxx22=(LL)X*d[i]+(LL)Y*p[i];
}
}
if(maxnum1!=maxnum2)return maxx11+maxx21;
return max(maxx11+maxx22, maxx12+maxx21);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
