# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
764258 | idkhandle | 십자가 놓기 (FXCUP4_cross) | C++17 | 1078 ms | 18240 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cross.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
const int INF = 1e9;
ll SelectCross(int K, vector<int> I, vector<int> O) {
int n = I.size();
vector<pii> a;
for (int i = 0; i < n; i++) {
a.emplace_back(I[i], O[i]);
}
sort(a.begin(), a.end());
multiset<int> st;
ll ans = 0;
for (int i = n - 1; i >= 0; i--) {
if (st.size() >= K - 1) {
auto it = st.rbegin();
for (int j = 0; j < K - 2; j++) {
it = next(it);
}
ans = max(ans, a[i].first * (2LL * min((K == 1 ? INF : *it), a[i].second) - a[i].first));
}
st.insert(a[i].second);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |