답안 #447459

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447459 2021-07-26T11:34:34 Z fuad27 Sure Bet (CEOI17_sure) C++14
100 / 100
202 ms 4216 KB
#include<bits/stdc++.h>
using namespace std;
int main () {
	long long n,Ai=0,Bi=0;cin>>n;
	long double ans=0.0,sA=0.0,sB=0.0,a[n+1] = {0},b[n+1] = {0};
	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);
	while(Ai<=n && Bi<=n) {
		if(sB<sA)sB+=b[Bi],Bi++;
		else sA+=a[Ai], Ai++;
	
		ans = max(ans,min(sA-Ai-Bi,sB-Ai-Bi));
	}
	cout.precision(4);
	cout<<fixed<<ans;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 2 ms 332 KB Output is correct
13 Correct 2 ms 332 KB Output is correct
14 Correct 2 ms 332 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Correct 164 ms 4192 KB Output is correct
18 Correct 180 ms 4216 KB Output is correct
19 Correct 159 ms 4140 KB Output is correct
20 Correct 172 ms 4200 KB Output is correct
21 Correct 202 ms 4128 KB Output is correct
22 Correct 164 ms 4160 KB Output is correct
23 Correct 173 ms 4180 KB Output is correct
24 Correct 167 ms 4176 KB Output is correct
25 Correct 159 ms 4084 KB Output is correct
26 Correct 198 ms 4076 KB Output is correct