# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
151233 | 2019-09-02T09:41:09 Z | dolphingarlic | 십자가 놓기 (FXCUP4_cross) | C++17 | 106 ms | 8036 KB |
#include "cross.h" #include <bits/stdc++.h> #define FOR(i, x, y) for (int i = x; i < y; i++) typedef long long ll; using namespace std; ll SelectCross(int K, vector<int> I, vector<int> O) { int N = I.size(); vector<pair<ll, ll>> crosses; FOR(i, 0, N) crosses.push_back({I[i], O[i]}); sort(crosses.begin(), crosses.end(), greater<pair<ll, ll>>()); priority_queue<ll> pq; ll ans = 0; FOR(i, 0, N) { pq.push(-crosses[i].second); if (pq.size() >= K) pq.pop(); if (pq.size() >= K - 1) ans = max(ans, -pq.top() * crosses[i].first * 2 - crosses[i].first * crosses[i].first); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 1016 KB | Output is correct |
6 | Correct | 106 ms | 7904 KB | Output is correct |
7 | Correct | 105 ms | 8036 KB | Output is correct |
8 | Correct | 106 ms | 8036 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 1016 KB | Output is correct |
6 | Correct | 106 ms | 7904 KB | Output is correct |
7 | Correct | 105 ms | 8036 KB | Output is correct |
8 | Correct | 106 ms | 8036 KB | Output is correct |
9 | Incorrect | 2 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 252 KB | Output is correct |
2 | Correct | 2 ms | 376 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 | 1016 KB | Output is correct |
6 | Correct | 106 ms | 7904 KB | Output is correct |
7 | Correct | 105 ms | 8036 KB | Output is correct |
8 | Correct | 106 ms | 8036 KB | Output is correct |
9 | Incorrect | 2 ms | 256 KB | Output isn't correct |
10 | Halted | 0 ms | 0 KB | - |