n = int(input())
first = []
second = []
for i in range(n):
a,b = map(float, input().split())
a*=10000
b*=10000
a = round(a)
b = round(b)
first.append(a)
second.append(b)
first.sort(reverse=True)
second.sort(reverse=True)
def test(x):
sus1 = first[0]
sus2 = second[0]
count = 2
f = 1
s = 1
while not (f==n and s==n):
if f!=n and sus1-count*10000 < x:
sus1 += first[f]
f+=1
count += 1
continue
if s!=n and sus2-count*10000 < x:
sus2 += second[s]
s+=1
count += 1
continue
break
if min(sus1-count*10000, sus2-count*10000) <x:
return False
else:
return True
lo = 0
hi = 10000000000000
while (lo<hi):
mid = (lo+hi+1)//2
if test(mid):
lo = mid
else:
hi = mid-1
print("%.4lf"%(lo/10000))
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
18216 KB |
Output is correct |
2 |
Correct |
34 ms |
18112 KB |
Output is correct |
3 |
Correct |
34 ms |
18200 KB |
Output is correct |
4 |
Correct |
35 ms |
18232 KB |
Output is correct |
5 |
Correct |
34 ms |
18232 KB |
Output is correct |
6 |
Correct |
35 ms |
18220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
18216 KB |
Output is correct |
2 |
Correct |
34 ms |
18112 KB |
Output is correct |
3 |
Correct |
34 ms |
18200 KB |
Output is correct |
4 |
Correct |
35 ms |
18232 KB |
Output is correct |
5 |
Correct |
34 ms |
18232 KB |
Output is correct |
6 |
Correct |
35 ms |
18220 KB |
Output is correct |
7 |
Correct |
45 ms |
18964 KB |
Output is correct |
8 |
Correct |
46 ms |
19092 KB |
Output is correct |
9 |
Correct |
57 ms |
19052 KB |
Output is correct |
10 |
Correct |
56 ms |
18876 KB |
Output is correct |
11 |
Correct |
44 ms |
18864 KB |
Output is correct |
12 |
Correct |
81 ms |
20112 KB |
Output is correct |
13 |
Correct |
73 ms |
20040 KB |
Output is correct |
14 |
Correct |
84 ms |
20216 KB |
Output is correct |
15 |
Correct |
75 ms |
20060 KB |
Output is correct |
16 |
Correct |
101 ms |
19820 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
35 ms |
18216 KB |
Output is correct |
2 |
Correct |
34 ms |
18112 KB |
Output is correct |
3 |
Correct |
34 ms |
18200 KB |
Output is correct |
4 |
Correct |
35 ms |
18232 KB |
Output is correct |
5 |
Correct |
34 ms |
18232 KB |
Output is correct |
6 |
Correct |
35 ms |
18220 KB |
Output is correct |
7 |
Correct |
45 ms |
18964 KB |
Output is correct |
8 |
Correct |
46 ms |
19092 KB |
Output is correct |
9 |
Correct |
57 ms |
19052 KB |
Output is correct |
10 |
Correct |
56 ms |
18876 KB |
Output is correct |
11 |
Correct |
44 ms |
18864 KB |
Output is correct |
12 |
Correct |
81 ms |
20112 KB |
Output is correct |
13 |
Correct |
73 ms |
20040 KB |
Output is correct |
14 |
Correct |
84 ms |
20216 KB |
Output is correct |
15 |
Correct |
75 ms |
20060 KB |
Output is correct |
16 |
Correct |
101 ms |
19820 KB |
Output is correct |
17 |
Correct |
359 ms |
31120 KB |
Output is correct |
18 |
Correct |
391 ms |
30996 KB |
Output is correct |
19 |
Correct |
370 ms |
30936 KB |
Output is correct |
20 |
Correct |
362 ms |
30976 KB |
Output is correct |
21 |
Correct |
371 ms |
31200 KB |
Output is correct |
22 |
Correct |
389 ms |
31048 KB |
Output is correct |
23 |
Correct |
371 ms |
30976 KB |
Output is correct |
24 |
Correct |
389 ms |
31076 KB |
Output is correct |
25 |
Correct |
350 ms |
30980 KB |
Output is correct |
26 |
Correct |
388 ms |
31404 KB |
Output is correct |