Submission #130913

# Submission time Handle Problem Language Result Execution time Memory
130913 2019-07-16T08:40:19 Z Diuven Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 376 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(i!=0) a += X[i], a--, b--;
		while(j<=n && b<a){
			b += Y[j++], b--, a--;
		}
		ans = max(ans, min(a,b));
	}
	cout<<fixed;
	cout.precision(4);
	cout<<ans<<'\n';

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Halted 0 ms 0 KB -