답안 #701076

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
701076 2023-02-20T03:20:56 Z Darren0724 Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
 
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;cin>>n;
	vector<double> a(n+1),b(n+1);
	for(int i=0;i<n;i++){
		cin>>a[i]>>b[i];
	}
	a[n]=0;
	b[n]=0;
	sort(all(a),greater<>());
	sort(all(b),greater<>());
	double total1=0,total2=0;
	int ptr1=0,ptr2=0;
	double ans=0;
	for(int i=0;i<n*2;i++){
		if(total1<total2){
			total1+=a[ptr1++];
		}
		else{
			total2+=b[ptr2++];
		}
		total1-=1;
		total2-=1;
		ans=max(min(total1,total2),ans);
	}
	cout<<fixed<<setprecision(4)<<ans<<endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 Halted 0 ms 0 KB -