結果

問題 No.647 明太子
コンテスト
ユーザー cologne
提出日時 2025-12-02 17:18:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 191 ms / 4,500 ms
コード長 579 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 82,596 KB
実行使用メモリ 77,572 KB
最終ジャッジ日時 2025-12-02 17:18:41
合計ジャッジ時間 3,129 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    n = int(input())
    ab = [tuple(map(int, input().split())) for _ in range(n)]
    m = int(input())
    xy = [tuple(map(int, input().split())) for _ in range(m)]
    cnt = [0] * m
    for a, b in ab:
        for i in range(m):
            x, y = xy[i]
            if x <= a and y >= b:
                cnt[i] += 1

    mx = max(cnt)
    if mx == 0:
        print(0)
        return
    for i in range(m):
        if cnt[i] == mx:
            print(i + 1)


if __name__ == '__main__':
    main()
0