| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1362339 | Newtonabc | Sure Bet (CEOI17_sure) | C++20 | 58 ms | 1976 KiB |
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
double a[N],b[N];
int main(){
int n; cin>>n;
for(int i=1;i<=n;i++) cin>>a[i] >>b[i];
sort(a+1,a+n+1,greater<double>());
sort(b+1,b+n+1,greater<double>());
double ans=0;
double cl=0,cr=0;
int p=1;
for(int i=1;i<=n;i++){
cl+=a[i]-1.0;
cr-=1.0;
while(p<=n && cr+(b[p]-1.0)<=cl-1.0){
cl-=1.0;
cr+=b[p]-1.0;
p++;
}
ans=max(ans,cr);
if(p<=n) ans=max(ans,cl-1.0);
}
cout<<fixed <<setprecision(4) <<ans;
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
