Submission #1088512

# Submission time Handle Problem Language Result Execution time Memory
1088512 2024-09-14T14:31:16 Z 4QT0R Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

vector<double> a;
vector<double> b;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n;
	cin >> n;
	a.resize(n);
	b.resize(n);
	for (int i = 0; i<n; i++)cin >> a[i] >> b[i];
	sort(a.begin(),a.end(),greater<double>());
	sort(b.begin(),b.end(),greater<double>());
	int x=0,y=0;
	double ans=0,sma=0,smb=0;
	while(min(x,y)<n){
		if (sma<smb && (y==n || x<n))sma+=a[x++];
		else smb+=b[y++];
		ans=max(ans,min(sma,smb)-(x+y));
	}
	cout << fixed << setprecision(4) << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -