Submission #151642

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1516422019-09-04 02:32:02baikdohyupOrganizing the Best Squad (FXCUP4_squad)C++17
0 / 100
163 ms10928 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

squad.cpp: In function 'long long int BestSquad(int, int)':
squad.cpp:18:21: warning: variable 'secondAidx' set but not used [-Wunused-but-set-variable]
  int firstAidx = 0, secondAidx = 0, firstDidx = 0, secondDidx = 0;
                     ^~~~~~~~~~
squad.cpp:18:52: warning: variable 'secondDidx' set but not used [-Wunused-but-set-variable]
  int firstAidx = 0, secondAidx = 0, firstDidx = 0, secondDidx = 0;
                                                    ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...