# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151642 | 2019-09-04T02:32:02 Z | baikdohyup | Organizing the Best Squad (FXCUP4_squad) | C++17 | 163 ms | 10928 KB |
#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; firstDidx = i; } } if (firstAidx == firstDidx) { return firstA + secondD > firstD + secondA ? firstA + secondD : firstD + secondA; } else { return firstA + firstD; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 380 KB | Output is correct |
3 | Correct | 163 ms | 10928 KB | Output is correct |
4 | Correct | 162 ms | 10928 KB | Output is correct |
5 | Correct | 12 ms | 1004 KB | Output is correct |
6 | Incorrect | 159 ms | 10844 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 15 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 3 ms | 380 KB | Output is correct |
3 | Correct | 163 ms | 10928 KB | Output is correct |
4 | Correct | 162 ms | 10928 KB | Output is correct |
5 | Correct | 12 ms | 1004 KB | Output is correct |
6 | Incorrect | 159 ms | 10844 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |