#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(10, 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(10, 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(10, 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 < d.size(); i++) for (int j = 0; j < d.size(); j++) if (i != j) z = max(z, 1ll * x * (d[i] + e[j]) + 1ll * y * (f[i] + f[j]));
return z;
}
Compilation message
squad.cpp: In function 'long long int BestSquad(int, int)':
squad.cpp:25:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < d.size(); i++) for (int j = 0; j < d.size(); j++) if (i != j) z = max(z, 1ll * x * (d[i] + e[j]) + 1ll * y * (f[i] + f[j]));
~~^~~~~~~~~~
squad.cpp:25:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < d.size(); i++) for (int j = 0; j < d.size(); j++) if (i != j) z = max(z, 1ll * x * (d[i] + e[j]) + 1ll * y * (f[i] + f[j]));
~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Incorrect |
6 ms |
380 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
16 ms |
512 KB |
Output is correct |
3 |
Incorrect |
989 ms |
18276 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
384 KB |
Output is correct |
2 |
Incorrect |
6 ms |
380 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |