結果

問題 No.647 明太子
ユーザー はむ吉🐹はむ吉🐹
提出日時 2018-02-09 22:58:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 350 ms / 4,500 ms
コード長 709 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 79,204 KB
最終ジャッジ日時 2023-09-09 09:26:01
合計ジャッジ時間 4,607 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
71,564 KB
testcase_01 AC 87 ms
71,480 KB
testcase_02 AC 85 ms
71,512 KB
testcase_03 AC 86 ms
71,528 KB
testcase_04 AC 85 ms
71,760 KB
testcase_05 AC 87 ms
71,448 KB
testcase_06 AC 84 ms
71,512 KB
testcase_07 AC 93 ms
76,856 KB
testcase_08 AC 94 ms
76,832 KB
testcase_09 AC 110 ms
77,260 KB
testcase_10 AC 119 ms
77,388 KB
testcase_11 AC 105 ms
77,264 KB
testcase_12 AC 119 ms
77,568 KB
testcase_13 AC 135 ms
77,620 KB
testcase_14 AC 238 ms
79,152 KB
testcase_15 AC 143 ms
77,624 KB
testcase_16 AC 113 ms
77,252 KB
testcase_17 AC 289 ms
79,080 KB
testcase_18 AC 284 ms
79,048 KB
testcase_19 AC 134 ms
78,580 KB
testcase_20 AC 137 ms
78,604 KB
testcase_21 AC 124 ms
77,620 KB
testcase_22 AC 350 ms
79,204 KB
testcase_23 AC 100 ms
77,332 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env pypy

import collections


def count_miracle_items(conds, props):
    ctr = collections.Counter()
    for j, (x, y) in enumerate(props, start=1):
        for a, b in conds:
            if x <= a and y >= b:
                ctr[j] += 1
    try:
        max_num = ctr.most_common(1)[0][1]
    except IndexError:
        return [0]
    else:
        return [k for k, v in ctr.items() if v == max_num]


def main():
    n = int(input())
    conds = [tuple(int(ab) for ab in input().split()) for _ in range(n)]
    m = int(input())
    props = [tuple(int(z) for z in input().split()) for _ in range(m)]
    print(*count_miracle_items(conds, props), sep="\n")


if __name__ == '__main__':
    main()
0