이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include<queue>
using namespace std;
int n;
double x, y, ans, c;
priority_queue<double> pq, pq2;
int main() {
cin >> n;
while(n--){
cin >> x >> y;
pq.push(x); pq2.push(y);
//cout << x << ' ' << y << endl;
}
x=y=0;
while(1){
if (x<y){
if (pq.empty()) break;
x+=pq.top(); pq.pop();
} else {
if (pq2.empty()) break;
y+=pq2.top(); pq2.pop();
}
c++;
//cout << x << ' ' << y << ' ' << c << endl;
ans=max(min(x, y)-c, ans);
}
printf("%.4lf", ans);
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... |