답안 #1086942

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1086942 2024-09-11T19:23:12 Z ZeroCool Sure Bet (CEOI17_sure) C++14
100 / 100
63 ms 5240 KB
#include <bits/stdc++.h>

using namespace std;

#define ar array
#define int long long
#define ld long double
#define crash assert(69 == 420)

const int MOD = 1e9 + 7;
const int INF = 1e17;
const int N = 2e5  + 20;
const int LOG = 20;


signed main(){ios_base::sync_with_stdio(false);cin.tie(0);
	int n;
	cin>>n;
	ld A[n], B[n];
	for(int i = 0;i < n;i++)cin>>A[i]>>B[i];
	sort(A, A + n);
	sort(B, B + n);
	reverse(A, A + n);
	reverse(B, B + n);
	ld ans = 0;
	ld x = 0, y = 0;
	int i = 0,j = 0;
	while(i < n || j < n){
		if(i < n && (j == n || x < y))x += A[i++];
		else y += B[j++];
		ans = max(ans, min(x, y) - i - j);
		//cout<<i<<" "<<j<<endl;
	}
	cout<<fixed<<setprecision(4)<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 58 ms 4852 KB Output is correct
18 Correct 62 ms 4728 KB Output is correct
19 Correct 61 ms 4944 KB Output is correct
20 Correct 59 ms 4692 KB Output is correct
21 Correct 62 ms 5240 KB Output is correct
22 Correct 62 ms 4944 KB Output is correct
23 Correct 59 ms 4944 KB Output is correct
24 Correct 59 ms 4724 KB Output is correct
25 Correct 60 ms 4696 KB Output is correct
26 Correct 63 ms 5204 KB Output is correct