結果

問題 No.647 明太子
ユーザー fV9TwBhUoa9S3eV
提出日時 2019-10-24 13:49:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 3,383 ms / 4,500 ms
コード長 1,001 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2024-07-16 00:51:14
合計ジャッジ時間 10,474 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

# No.647 明太子
n = int(input())        # 明太子同好会メンバーの数
a = []                  # j番目のメンバはAj円以内で
b = []                  # 辛さがBj以上の明太子を見ると購入せずにはいられない

for i in range(n):
    tmp = [int(s) for s in input().split()]
    a.append(tmp[0])
    b.append(tmp[1])

m = int(input())        # 明太子直売所ではM種類の明太子が販売されている
x = []                  # i番目の明太子の値段はXi円、
y = []                  # 辛さはYiである。

for i in range(m):
    tmp = [int(s) for s in input().split()]
    x.append(tmp[0])
    y.append(tmp[1])

bought = [0] * m

for i in range(n):
    for j in range(m):
        if x[j] <= a[i] and y[j] >= b[i]:
            bought[j] += 1

if max(bought) == 0:
    print(0)
elif bought.count(max(bought)) > 1:
    for i in range(m):
        if bought[i] == max(bought):
            print(i + 1)
else:
    print(bought.index(max(bought)) + 1)
0