답안 #52681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
52681 2018-06-26T11:02:52 Z snat123 Sure Bet (CEOI17_sure) C++14
0 / 100
2000 ms 472 KB
#include<bits/stdc++.h>
 
using namespace std;
 
double a[100001], b[100001];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    int n;
    cin >> n;
    for(int i=0; i<n; i++) cin >> a[i] >> b[i];
    sort(a, a+n);
	sort(b, b+n);
	int i=n-1, j=n-1;
	double x=0.0, y=0.0, res=0.0;
	while(i>=0 || j>=0){
		if(j>=0 && x>y) y+=b[j--];
		else if(i>=0) x+=a[i--];
		res=max(res, min(x, y)-(n-i)-(n-j)+2);
	}
	cout << fixed << setprecision(4) << res;
    return 0;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 372 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 3 ms 392 KB Output is correct
4 Execution timed out 2048 ms 472 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 372 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 3 ms 392 KB Output is correct
4 Execution timed out 2048 ms 472 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 372 KB Output is correct
2 Correct 2 ms 372 KB Output is correct
3 Correct 3 ms 392 KB Output is correct
4 Execution timed out 2048 ms 472 KB Time limit exceeded
5 Halted 0 ms 0 KB -