結果

問題 No.647 明太子
ユーザー ys
提出日時 2018-02-09 22:37:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 547 ms / 4,500 ms
コード長 557 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 77,368 KB
最終ジャッジ日時 2024-06-27 02:31:06
合計ジャッジ時間 3,507 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N = int(input())
rec = []
for i in range(N):
    a, b = map(int, input().split())
    rec.append((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[0] >= x and s[1] <= 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