Submission #149593

# Submission time Handle Problem Language Result Execution time Memory
149593 2019-09-01T06:47:58 Z Cafe Maru(#3599, bryan, pps789, kazel) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
5 ms 384 KB
#include "cross.h"
#include<bits/stdc++.h>
using namespace std;

map<int,vector<int>> oi;

long long SelectCross(int K, std::vector<int> I, std::vector<int> O) {
	int N = I.size();
    for(int i=0;i<N;i++) {
        oi[-O[i]].push_back(I[i]);
    }
    int ans = 0;
    priority_queue<int> pq;
    for(auto& [z, s] : oi) {
        int x = -z;
        for(int i : s) {
            pq.push(-i);
        }
        while(pq.size() > K) pq.pop();
        if (pq.size() == K) {
            int y = -pq.top();
            int tmp = y*(2*x-y);
            if(tmp > ans) ans = tmp;
        }
    }
	return ans;
}

Compilation message

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:19:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(pq.size() > K) pq.pop();
               ~~~~~~~~~~^~~
cross.cpp:20:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (pq.size() == K) {
             ~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -