Submission #148942

# Submission time Handle Problem Language Result Execution time Memory
148942 2019-09-01T05:25:50 Z JeffreyHo(#3776, JeffreyHo) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
7 ms 1968 KB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;

long long SelectCross(int k, std::vector<int> a, std::vector<int> b) {
	int n = (int)a.size();
    pair<int, int> c[200005] = {};
    for (int i = 0; i < n; i++) c[i] = {b[i], a[i]};
    sort(c, c + n); reverse(c, c + n);
    multiset<int> s;
    for (int i = 0; i < k; i++) s.insert(c[i].second);
    long long z = 1ll * c[k - 1].first * c[k - 1].first - 1ll * *s.rbegin() * *s.rbegin();
    for (int i = k; i < n; i++) {
        s.insert(c[i].second);
        s.erase(s.find(*s.rbegin()));
        z = max(z, 1ll * c[i].first * c[i].first - 1ll * *s.rbegin() * *s.rbegin());
    }
	return z;
}
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1968 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 1968 KB Output isn't correct
2 Halted 0 ms 0 KB -