Submission #39868335


Source Code Expand

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353
import bisect
n, m, k = mi()
AB = [li() for _ in range(n)]
CD = [li() for _ in range(m)]

def check(x):
    ans = 0
    A = []
    for i in range(n):
        ai, bi = AB[i]
        A.append((100 - x) * ai - x * bi)
    B = []
    for j in range(m):
        cj, dj = CD[j]
        B.append((x - 100) * cj + x * dj)
    A.sort()
    B.sort()
    for v in A:
        ans += bisect.bisect_left(B, v)
    
    return ans >= k

ng = 100 - 10 ** (-15)

ok = 10 ** (-15)

for _ in range(60):
    mid = (ok + ng) / 2
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)




Submission Info

Submission Time
Task F - Sugar Water 2
User Shirotsume
Language PyPy3 (7.3.0)
Score 500
Code Size 849 Byte
Status AC
Exec Time 1687 ms
Memory 150084 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 33
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 02_biased_00.txt, 02_biased_01.txt, 02_biased_02.txt, 02_biased_03.txt, 02_biased_04.txt, 02_biased_05.txt, 02_biased_06.txt, 02_biased_07.txt, 02_biased_08.txt, 02_biased_09.txt, 03_border_00.txt, 03_border_01.txt, 03_border_02.txt, 03_border_03.txt, 03_border_04.txt, 03_border_05.txt, 03_border_06.txt, 03_border_07.txt, 03_border_08.txt, 03_border_09.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 68 ms 65624 KB
00_sample_01.txt AC 55 ms 65612 KB
00_sample_02.txt AC 57 ms 65796 KB
01_random_00.txt AC 1482 ms 144796 KB
01_random_01.txt AC 1457 ms 144748 KB
01_random_02.txt AC 1519 ms 143820 KB
01_random_03.txt AC 1513 ms 144744 KB
01_random_04.txt AC 1546 ms 143668 KB
01_random_05.txt AC 1458 ms 145756 KB
01_random_06.txt AC 595 ms 101364 KB
01_random_07.txt AC 425 ms 90956 KB
01_random_08.txt AC 265 ms 81032 KB
01_random_09.txt AC 686 ms 111952 KB
02_biased_00.txt AC 1420 ms 144996 KB
02_biased_01.txt AC 1431 ms 145088 KB
02_biased_02.txt AC 1438 ms 144988 KB
02_biased_03.txt AC 1459 ms 145084 KB
02_biased_04.txt AC 1647 ms 145356 KB
02_biased_05.txt AC 1674 ms 145220 KB
02_biased_06.txt AC 1687 ms 145352 KB
02_biased_07.txt AC 1360 ms 146144 KB
02_biased_08.txt AC 1394 ms 145560 KB
02_biased_09.txt AC 1353 ms 145044 KB
03_border_00.txt AC 1336 ms 143116 KB
03_border_01.txt AC 567 ms 97136 KB
03_border_02.txt AC 792 ms 111124 KB
03_border_03.txt AC 57 ms 65560 KB
03_border_04.txt AC 1637 ms 150084 KB
03_border_05.txt AC 572 ms 96996 KB
03_border_06.txt AC 799 ms 111140 KB
03_border_07.txt AC 60 ms 65608 KB
03_border_08.txt AC 58 ms 65608 KB
03_border_09.txt AC 57 ms 65716 KB