結果

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

ソースコード

diff #
raw source code

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

    ab = dict()
    for i, (a, b) in enumerate(sorted(AB, reverse=True)):
        ab[i] = (a, b)

    men = [0] * M
    for i in range(M):
        x, y = XY[i]
        for j in range(N):
            a, b = ab[j]
            if x <= a:
                if y >= b:
                    men[i] += 1
            else:
                break

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

main()
0