#include "squad.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> d, e, f;
void Init(std::vector<int> a, std::vector<int> b, std::vector<int> c) {
int n = (int)a.size();
set<int> s;
vector<pair<int, int>> x, y, z;
for (int i = 0; i < n; i++) x.push_back({a[i], i});
sort(x.begin(), x.end()); reverse(x.begin(), x.end());
for (int i = 0; i < min(100, n); i++) s.insert(x[i].second);
for (int i = 0; i < n; i++) y.push_back({b[i], i});
sort(y.begin(), y.end()); reverse(y.begin(), y.end());
for (int i = 0; i < min(100, n); i++) s.insert(y[i].second);
for (int i = 0; i < n; i++) z.push_back({c[i], i});
sort(z.begin(), z.end()); reverse(z.begin(), z.end());
for (int i = 0; i < min(100, n); i++) s.insert(z[i].second);
for (int i : s) d.push_back(a[i]), e.push_back(b[i]), f.push_back(c[i]);
}
long long BestSquad(int x, int y) {
long long z = 0;
for (int i = 0; i < (int)d.size(); i++) for (int j = 0; j < (int)d.size(); j++) if (i != j) z = max(z, 1ll * x * (d[i] + e[j]) + 1ll * y * (f[i] + f[j]));
return z;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Incorrect |
295 ms |
18264 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
498 ms |
632 KB |
Output is correct |
3 |
Execution timed out |
3100 ms |
18272 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Correct |
7 ms |
384 KB |
Output is correct |
3 |
Incorrect |
295 ms |
18264 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |