結果

問題 No.1280 Beyond C
ユーザー Yosh
提出日時 2020-11-06 23:01:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 2,555 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 113,444 KB
最終ジャッジ日時 2024-07-22 13:32:21
合計ジャッジ時間 6,142 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

from __future__ import print_function

from functools import reduce
from operator import mul
from collections import Counter
from collections import deque
from itertools import accumulate
from queue import Queue
from queue import PriorityQueue as pq
from heapq import heapreplace
from heapq import heapify
from heapq import heappushpop
from heapq import heappop
from heapq import heappush
import heapq
import time
import random
import bisect
import itertools
import collections
from fractions import Fraction
import fractions
import string
import math
import operator
import functools
import copy
import array
import re
import sys
sys.setrecursionlimit(500000)


input = sys.stdin.readline


# def # eprint(*args, **kwargs):
#     print(*args, file=sys.stderr, **kwargs)
#     return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod = 1000000007


def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x, y: x * y % mod, range(n, n - r, -1), 1)
    denom = pow(reduce(lambda x, y: x * y % mod, range(1, r + 1), 1), mod - 2, mod)
    return numer * denom % mod


# def solve():


n, m, c = map(int, input().strip().split())
a = sorted(list(map(int, input().strip().split())))
b = sorted(list(map(int, input().strip().split()))) + [sys.maxsize]
# eprint('a,b ',end=':\n')
# eprint(a,b)

cnt = 0
for i in range(n):
    #
    if a[i] * b[0] > c:
        cnt += m
        continue
    #
    #

    def is_ok(m):
        if a[i] * b[m] > c:
            return True
        else:
            return False

    # にぶたんのメイン処理
    ok = m
    ng = 0
    while abs(ok - ng) > 1:  # 条件を満たすindex ok と 条件を満たさないindex ng が ちょうど 1 ズレる(ちょうどokとngで境界になる)まで続ける
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    cnt += (m - 1) - ng
    # eprint('a[i],b[ok],cnt,m,ng,ok ',end=':\n')
    # eprint(a[i],b[ok],cnt,m,ng,ok)
    # if (m - 1) - ng < 0:
        # eprint('error: n-ng,  ', end=':\n')
        # eprint(n - ng)
        # eprint('cnt ',end=':\n')
        # eprint(cnt)
print(cnt / (n * m))
0