結果

問題 No.647 明太子
コンテスト
ユーザー GrayCoder
提出日時 2018-02-12 07:13:47
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 482 ms / 4,500 ms
+ 998µs
コード長 641 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 306 ms
コンパイル使用メモリ 21,412 KB
実行使用メモリ 16,508 KB
最終ジャッジ日時 2026-07-30 21:29:23
合計ジャッジ時間 5,287 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import bisect

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

    a = [0] * N
    b = a[:]
    AB.sort()
    for i, j in enumerate(AB):
        a[i], b[i] = j

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

    max_ = max(men)
    if not max_:
        print(0)
    else:
        ans = [i + 1 for i, j in enumerate(men) if j == max_]
        print(*ans, sep='\n')

main()
0