結果

問題 No.647 明太子
コンテスト
ユーザー ys
提出日時 2018-02-09 22:35:46
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 3,434 ms / 4,500 ms
+ 471µs
コード長 560 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 57 ms
コンパイル使用メモリ 14,976 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2026-10-08 05:23:30
合計ジャッジ時間 9,178 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import defaultdict
N = int(input())
rec = []
for i in range(N):
    a, b = map(int, input().split())
    rec.append((i, a, b))

M = int(input())
max_ = 0
dic = defaultdict(int)
tmp = []
for i in range(M):
    x, y = map(int, input().split())
    for s in rec:
        if s[1] >= x and s[2] <= y:
            dic[i] += 1
            if dic[i] == max_:
                tmp.append(i)
            if dic[i] > max_:
                max_ = dic[i]
                tmp = [i]

if len(tmp) == 0:
    print(0)
else:
    for i in tmp:
        print(i + 1)
0