답안 #447430

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447430 2021-07-26T10:05:39 Z osmanallazov Sure Bet (CEOI17_sure) C++14
100 / 100
175 ms 1840 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
	int t;
	cin>>t;
	double ans=0,suma=0,sumb=0;
	double a[t+1];
	double b[t+1];
	int a1=0;
	int b1=0;
	for(int i=0;i<t;i++){
        cin>>a[i];
        cin>>b[i];
	}
	sort(a,a+t);
	reverse(a,a+t);
    sort(b,b+t);
    reverse(b,b+t);
    while(a1<=t && b1<=t){
        if(sumb<suma){
			sumb+=b[b1];
			b1++;
		}else{
			suma+=a[a1];
			a1++;
		}
		ans=max(ans,min(suma-a1-b1,sumb-a1-b1));
    }
    cout.precision(4);
    cout<<fixed<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 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 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 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 0 ms 204 KB Output is correct
6 Correct 1 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 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 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 0 ms 204 KB Output is correct
6 Correct 1 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 204 KB Output is correct
13 Correct 2 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 204 KB Output is correct
16 Correct 2 ms 204 KB Output is correct
17 Correct 148 ms 1840 KB Output is correct
18 Correct 142 ms 1836 KB Output is correct
19 Correct 146 ms 1840 KB Output is correct
20 Correct 161 ms 1832 KB Output is correct
21 Correct 175 ms 1832 KB Output is correct
22 Correct 142 ms 1740 KB Output is correct
23 Correct 147 ms 1828 KB Output is correct
24 Correct 166 ms 1832 KB Output is correct
25 Correct 157 ms 1740 KB Output is correct
26 Correct 166 ms 1828 KB Output is correct