結果

問題 No.647 明太子
ユーザー hedwig100
提出日時 2020-05-15 19:51:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,662 ms / 4,500 ms
コード長 685 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-09-19 06:16:35
合計ジャッジ時間 8,874 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():  
    N = int(input())
    want = [tuple(map(int,input().split())) for _ in range(N)]
    M = int(input())
    mentaiko = [tuple(map(int,input().split())) for _ in range(M)]

    bought = [0] * M
    max_bought = 0
    for a,b in want:
        for i,(x,y) in enumerate(mentaiko):
            if x <= a and b <= y:
                bought[i] += 1
                max_bought = max(max_bought,bought[i])

    if max_bought == 0:
        print(0)
    else:
        ans = [i + 1 for i in range(M) if bought[i] == max_bought]
        print('\n'.join(map(str,ans)))
if __name__ == '__main__':
    main()
0