結果

問題 No.647 明太子
ユーザー GrayCoder
提出日時 2018-02-11 18:22:10
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 589 ms / 4,500 ms
コード長 607 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2024-06-27 02:40:06
合計ジャッジ時間 3,526 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def main():
    N = int(input())
    AB = tuple(tuple(map(int, input().split())) for _ in [0] * N)
    M = int(input())
    XY = tuple(tuple(map(int, input().split())) for _ in [0] * M)

    ab = sorted(AB)
    a = [a for a, b in ab]
    b = [b for a, b in ab]
    men = [0] * M
    for i, (x, y) in enumerate(XY):
        j = bisect.bisect_left(a, x)
        b_ = sorted(b[j:])
        k = bisect.bisect(b_, y)
        men[i] += k

    max_ = max(men)
    if not max_:
        print(0)
    else:
        for i in [j for j, k in enumerate(men) if k == max_]:
            print(i + 1)

main()
0