Submission #149663

# Submission time Handle Problem Language Result Execution time Memory
149663 2019-09-01T06:55:39 Z JeffreyHo(#3776, JeffreyHo) Organizing the Best Squad (FXCUP4_squad) C++17
0 / 100
3000 ms 18272 KB
#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;
}
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -