# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
114745 | PeppaPig | Sure Bet (CEOI17_sure) | C++14 | 2 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
int n;
priority_queue<double> Q1, Q2;
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; i++) {
double a, b;
scanf("%lf %lf", &a, &b);
Q1.emplace(a), Q2.emplace(b);
}
double ans = 0, a = 0, b = 0;
for(int i = 1; i <= 2 * n; i++) {
if(!Q1.empty() && a < b) {
a += Q1.top();
Q1.pop();
} else {
b += Q2.top();
Q2.pop();
}
ans = max(ans, min(a, b) - i);
}
printf("%.4lf\n", ans);
return 0;
}
컴파일 시 표준 에러 (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... |