답안 #149156

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149156 2019-09-01T05:50:41 Z 본인 하지만 안 어림 ㅋㅋ(#3569, gs13105, xdoju, gs13068) 십자가 놓기 (FXCUP4_cross) C++17
100 / 100
127 ms 6876 KB
#include <bits/stdc++.h>
using namespace std;

#include "cross.h"

struct pos
{
    int x, y;
    bool operator <(const pos &a) const
    {
        return x != a.x ? x > a.x : y > a.y;
    }
};

long long SelectCross(int k, std::vector<int> I, std::vector<int> O) {
    int n = I.size(), i;

    vector<pos> v;
    for(i = 0; i < n; i++)
        v.push_back({ O[i], I[i] });

    sort(v.begin(), v.end());

    long long res = 0;
    priority_queue<int> pq;
    for(i = 0; i < n; i++)
    {
        pq.push(-v[i].y);

        while((int)pq.size() > k)
            pq.pop();

        if((int)pq.size() == k)
        {
            int x = v[i].x;
            int y = -pq.top();

            long long cur = 2LL * x * y - 1LL * y * y;
            res = max(res, cur);
        }
    }

    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 256 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 768 KB Output is correct
6 Correct 115 ms 5736 KB Output is correct
7 Correct 111 ms 5740 KB Output is correct
8 Correct 112 ms 5740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 256 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 768 KB Output is correct
6 Correct 115 ms 5736 KB Output is correct
7 Correct 111 ms 5740 KB Output is correct
8 Correct 112 ms 5740 KB Output is correct
9 Correct 5 ms 304 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 59 ms 3188 KB Output is correct
14 Correct 111 ms 5732 KB Output is correct
15 Correct 117 ms 5736 KB Output is correct
16 Correct 117 ms 5740 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Output is correct
2 Correct 5 ms 256 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 768 KB Output is correct
6 Correct 115 ms 5736 KB Output is correct
7 Correct 111 ms 5740 KB Output is correct
8 Correct 112 ms 5740 KB Output is correct
9 Correct 5 ms 304 KB Output is correct
10 Correct 6 ms 384 KB Output is correct
11 Correct 6 ms 384 KB Output is correct
12 Correct 12 ms 768 KB Output is correct
13 Correct 59 ms 3188 KB Output is correct
14 Correct 111 ms 5732 KB Output is correct
15 Correct 117 ms 5736 KB Output is correct
16 Correct 117 ms 5740 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 6 ms 384 KB Output is correct
19 Correct 12 ms 896 KB Output is correct
20 Correct 63 ms 3184 KB Output is correct
21 Correct 90 ms 5100 KB Output is correct
22 Correct 115 ms 5480 KB Output is correct
23 Correct 124 ms 5744 KB Output is correct
24 Correct 127 ms 5740 KB Output is correct
25 Correct 121 ms 6632 KB Output is correct
26 Correct 113 ms 6876 KB Output is correct