Submission #150376

# Submission time Handle Problem Language Result Execution time Memory
150376 2019-09-01T08:15:18 Z graneli(#3789, toloraia) Crosses on the Grid (FXCUP4_cross) C++17
0 / 100
12 ms 512 KB
#include "cross.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define mp make_pair
#define pb push_back
//#define ll __int128
#define ll long long
#define LEFT(a) ((a)<<1)
#define RIGHT(a) (LEFT(a) + 1)
#define MID(a,b) ((a+b)>>1)
#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define y1 y122
using namespace std;

const ll N = 200005, M = 1e9;

int n;

pair < ll, ll > P[N];

ll L[N], R[N];

ll ans, pas;

priority_queue < ll > Q;

ll SelectCross(int K, std::vector<int> aaa, std::vector<int> bbb) {
	n = aaa.size();
	for (int i = 1; i <= n; i++){
        P[i].F = aaa[i - 1];
        P[i].S = bbb[i - 1];
	}
	sort (P + 1, P + n + 1);
	for (int i = 1; i <= n; i++){
        L[i] = P[i].F;
        R[i] = P[i].S;
	}
	for (int i = n; i >= 1; i--){
        if (Q.size() == K - 1){
            ll x = L[i];
            ll y = -Q.top();
            if (y > R[i])
                y = R[i];
            pas = y * y - (x - y) * (x - y);
            ans = max (ans, pas);
        }
        Q.push (-R[i]);
        if (Q.size() >= K)
            Q.pop();
	}
	return ans;
}

Compilation message

cross.cpp: In function 'long long int SelectCross(int, std::vector<int>, std::vector<int>)':
cross.cpp:41:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Q.size() == K - 1){
             ~~~~~~~~~^~~~~~~~
cross.cpp:50:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (Q.size() >= K)
             ~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 12 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -