Submission #149110

# Submission time Handle Problem Language Result Execution time Memory
149110 2019-09-01T05:45:39 Z お前はもう死んでいる(#3784, kuroni, nvmdava, tfg) Crosses on the Grid (FXCUP4_cross) C++17
100 / 100
138 ms 10212 KB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
vector<pair<long long, long long> > cr;

long long res = 0;

priority_queue<long long> pq;

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	int n = I.size();
	for(int i = 0; i < n; i++)
		cr.push_back({I[i], O[i]});
	sort(cr.rbegin(), cr.rend());

	for(int i = 0; i < n; i++){
		pq.push(-cr[i].ss);
		if(i >= K) pq.pop();
		if(i >= K - 1){
			res = max(res, -pq.top() * cr[i].ff * 2 - cr[i].ff * cr[i].ff);
		}
	}

	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 13 ms 1024 KB Output is correct
6 Correct 118 ms 7652 KB Output is correct
7 Correct 119 ms 7740 KB Output is correct
8 Correct 118 ms 7780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 13 ms 1024 KB Output is correct
6 Correct 118 ms 7652 KB Output is correct
7 Correct 119 ms 7740 KB Output is correct
8 Correct 118 ms 7780 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 232 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 13 ms 1024 KB Output is correct
13 Correct 62 ms 4204 KB Output is correct
14 Correct 120 ms 7784 KB Output is correct
15 Correct 121 ms 7780 KB Output is correct
16 Correct 137 ms 7780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 13 ms 1024 KB Output is correct
6 Correct 118 ms 7652 KB Output is correct
7 Correct 119 ms 7740 KB Output is correct
8 Correct 118 ms 7780 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 232 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 13 ms 1024 KB Output is correct
13 Correct 62 ms 4204 KB Output is correct
14 Correct 120 ms 7784 KB Output is correct
15 Correct 121 ms 7780 KB Output is correct
16 Correct 137 ms 7780 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 13 ms 1024 KB Output is correct
20 Correct 68 ms 4204 KB Output is correct
21 Correct 97 ms 7144 KB Output is correct
22 Correct 124 ms 7780 KB Output is correct
23 Correct 126 ms 7652 KB Output is correct
24 Correct 130 ms 7780 KB Output is correct
25 Correct 138 ms 9800 KB Output is correct
26 Correct 125 ms 10212 KB Output is correct