Submission #152025

# Submission time Handle Problem Language Result Execution time Memory
152025 2019-09-06T02:58:04 Z tmwilliamlin168 Crosses on the Grid (FXCUP4_cross) C++17
100 / 100
117 ms 10476 KB
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;

array<int, 2> a[200000];

long long SelectCross(int k, vector<int> x, vector<int> y) {
	long long ans=0;
	for(int i=0; i<x.size(); ++i)
		a[i]={x[i], y[i]};
	sort(a, a+x.size(), greater<>());
	priority_queue<int, vector<int>, greater<int>> pq;
	for(int i=0; i<k-1; ++i)
		pq.push(a[i][1]);
	for(int i=k-1; i<x.size(); ++i) {
		pq.push(a[i][1]);
		ans=max((long long)a[i][0]*(2*pq.top()-a[i][0]), ans);
		pq.pop();
	}
	return ans;
}

Compilation message

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:9:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<x.size(); ++i)
               ~^~~~~~~~~
cross.cpp:15:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=k-1; i<x.size(); ++i) {
                 ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Correct 104 ms 8936 KB Output is correct
7 Correct 104 ms 8940 KB Output is correct
8 Correct 109 ms 8960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Correct 104 ms 8936 KB Output is correct
7 Correct 104 ms 8940 KB Output is correct
8 Correct 109 ms 8960 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 55 ms 4976 KB Output is correct
14 Correct 107 ms 9056 KB Output is correct
15 Correct 107 ms 8972 KB Output is correct
16 Correct 108 ms 9096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Correct 104 ms 8936 KB Output is correct
7 Correct 104 ms 8940 KB Output is correct
8 Correct 109 ms 8960 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 8 ms 888 KB Output is correct
13 Correct 55 ms 4976 KB Output is correct
14 Correct 107 ms 9056 KB Output is correct
15 Correct 107 ms 8972 KB Output is correct
16 Correct 108 ms 9096 KB Output is correct
17 Correct 2 ms 380 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 9 ms 1144 KB Output is correct
20 Correct 60 ms 4848 KB Output is correct
21 Correct 87 ms 7352 KB Output is correct
22 Correct 110 ms 9064 KB Output is correct
23 Correct 113 ms 9188 KB Output is correct
24 Correct 117 ms 9068 KB Output is correct
25 Correct 116 ms 10476 KB Output is correct
26 Correct 109 ms 10344 KB Output is correct