답안 #130915

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
130915 2019-07-16T08:43:19 Z Diuven Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef pair<int, int> pii;

const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;

int n;
double X[MAX], Y[MAX], ans;

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	cin>>n;
	for(int i=1; i<=n; i++)
		cin>>X[i]>>Y[i];
	sort(X+1, X+n+1, greater<double>());
	sort(Y+1, Y+n+1, greater<double>());
	for(int i=0, j=1; i<=n; i++){
		static double a = 0, b = 0;
		if(X[i]>1) a += X[i], a--, b--;
		while(j<=n && b<a && Y[j]>1){
			b += Y[j++], b--, a--;
		}
		ans = max(ans, min(a,b));
	}
	cout<<fixed;
	cout.precision(4);
	cout<<ans<<'\n';

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