이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
priority_queue<ld> pq1, pq2;
int main()
{
int n;
cin>>n;
for(int i = 1; i <= n; i++)
{
ld a, b;
cin>>a>>b;
pq1.push(a);
pq2.push(b);
}
ld r1 = 0.0, r2 = 0.0, rez = 0.0;
n *= 2;
while(n--)
{
r1 -= (ld)1;
r2 -= (ld)1;
if(r1 < r2 || pq2.empty())
{
if(!pq1.empty())
{
r1 += (ld)pq1.top();
pq1.pop();
}
}
else
{
if(!pq2.empty())
{
r2 += (ld)pq2.top();
pq2.pop();
}
}
rez = max(rez, min(r1, r2));
}
printf("%.4lf",(double)rez);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |