# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151642 | baikdohyup | Organizing the Best Squad (FXCUP4_squad) | C++17 | 163 ms | 10928 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 <algorithm>
#include <iostream>
std::vector<int> arr1, arr2, arr3;
int N;
void Init(std::vector<int> A, std::vector<int> D, std::vector<int> P){
N = A.size();
arr1 = A;
arr2 = D;
arr3 = P;
}
long long BestSquad(int X, int Y){
long long firstA = 0, secondA = 0, firstD = 0, secondD = 0;
int firstAidx = 0, secondAidx = 0, firstDidx = 0, secondDidx = 0;
for (int i = 0; i < N; i++) {
if ((long long)arr1[i] * (long long)X + (long long)arr3[i] * (long long)Y >= firstA) {
secondA = firstA;
secondAidx = firstAidx;
firstA = (long long)arr1[i] * (long long)X + (long long)arr3[i] * (long long)Y;
firstAidx = i;
}
if ((long long)arr2[i] * (long long)X + (long long)arr3[i] * (long long)Y >= firstD) {
secondD = firstD;
secondDidx = firstDidx;
firstD = (long long)arr2[i] * (long long)X + (long long)arr3[i] * (long long)Y;
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... |