답안 #921500

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
921500 2024-02-04T03:13:54 Z PM1 Sure Bet (CEOI17_sure) C++17
0 / 100
11 ms 468 KB
#include <bits/stdc++.h>
using namespace std;
const int mxn=1e5+5;
int n;
double a[mxn],b[mxn];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i]>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	double L=0,R=1e8;
	int t=200;
	while(t--){
		double mid=(L+R)/2,sum1=0,sum2=0;
		int p=n;
		for(int i=n;i>0;i--){
			while(p>0 && sum2<mid){
				sum2+=b[p]-1;
				p++;
				sum1--;
			}
			if(sum1>=mid)break;
			sum1+=a[i]-1;
			sum2--;
		}
		if(sum1>=mid && sum2>=mid)
			L=mid;
		else
			R=mid;
	}
	cout<<fixed<<setprecision(4);
	cout<<L<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 468 KB Output is correct
3 Incorrect 11 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 468 KB Output is correct
3 Incorrect 11 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 348 KB Output is correct
2 Correct 5 ms 468 KB Output is correct
3 Incorrect 11 ms 344 KB Output isn't correct
4 Halted 0 ms 0 KB -