結果

問題 No.647 明太子
コンテスト
ユーザー iad_2889
提出日時 2019-05-16 02:11:37
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,715 ms / 4,500 ms
コード長 616 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 358 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 18,008 KB
最終ジャッジ日時 2026-04-04 17:48:27
合計ジャッジ時間 8,427 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def is_buy(budget,taste):
    def _(price,hot):
        return budget >= price and taste <= hot
    return _

N = int(input())
members = [is_buy(*map(int,input().split())) for x in range(N)]
M = int(input())

mentaiko = {}
popular = 0
for i in range(M):
    price,hot = map(int,input().split())
    cnt = 0
    for member in members:
        if member(price,hot):
            cnt+=1
    if cnt:
        mentaiko[i + 1] = cnt
        popular = max(popular,cnt)

if mentaiko:
    mentaiko = sorted([x for x,y in mentaiko.items() if y == popular])
    for miracle in mentaiko:
        print(miracle)
else:
    print(0)
0