結果

問題 No.647 明太子
ユーザー fV9TwBhUoa9S3eVfV9TwBhUoa9S3eV
提出日時 2019-10-24 13:49:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 3,059 ms / 4,500 ms
コード長 1,001 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2023-09-23 00:17:24
合計ジャッジ時間 10,662 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,864 KB
testcase_01 AC 15 ms
7,904 KB
testcase_02 AC 16 ms
7,808 KB
testcase_03 AC 16 ms
7,956 KB
testcase_04 AC 16 ms
7,908 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 16 ms
7,956 KB
testcase_07 AC 17 ms
7,780 KB
testcase_08 AC 17 ms
7,848 KB
testcase_09 AC 39 ms
8,244 KB
testcase_10 AC 66 ms
8,252 KB
testcase_11 AC 28 ms
7,852 KB
testcase_12 AC 55 ms
8,324 KB
testcase_13 AC 102 ms
8,400 KB
testcase_14 AC 1,018 ms
8,920 KB
testcase_15 AC 153 ms
8,408 KB
testcase_16 AC 50 ms
8,308 KB
testcase_17 AC 1,245 ms
9,092 KB
testcase_18 AC 1,388 ms
8,956 KB
testcase_19 AC 369 ms
8,872 KB
testcase_20 AC 415 ms
8,876 KB
testcase_21 AC 157 ms
8,584 KB
testcase_22 AC 3,059 ms
9,472 KB
testcase_23 AC 21 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

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