# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
148737 | 코딩은 체육과목입니다 (#200) | Crosses on the Grid (FXCUP4_cross) | C++17 | 131 ms | 8860 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cross.h"
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second
using namespace std;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;
i64 SelectCross(int K, std::vector<int> I, std::vector<int> O)
{
int n = I.size();
vector<ii64> arr(n);
for (int i = 0; i < n; i++)
{
arr[i].xx = I[i];
arr[i].yy = O[i];
}
sort(all(arr));
priority_queue<i64, vector<i64>, greater<i64>> maxw;
i64 ans = 0;
for (int i = n - 1; i >= 0; i--)
{
maxw.push(arr[i].yy);
if (maxw.size() > K)
maxw.pop();
if (maxw.size() == K)
ans = max(ans, arr[i].xx * (2 * maxw.top() - arr[i].xx));
}
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... |