結果

問題 No.647 明太子
ユーザー GrayCoderGrayCoder
提出日時 2018-02-17 03:41:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 748 ms / 4,500 ms
コード長 786 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 13,612 KB
最終ジャッジ日時 2023-09-09 09:34:49
合計ジャッジ時間 4,238 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,020 KB
testcase_01 AC 17 ms
8,076 KB
testcase_02 AC 16 ms
8,076 KB
testcase_03 AC 16 ms
8,044 KB
testcase_04 AC 16 ms
8,112 KB
testcase_05 AC 17 ms
7,980 KB
testcase_06 AC 16 ms
8,040 KB
testcase_07 AC 16 ms
8,116 KB
testcase_08 AC 16 ms
8,028 KB
testcase_09 AC 24 ms
8,504 KB
testcase_10 AC 32 ms
8,608 KB
testcase_11 AC 20 ms
8,028 KB
testcase_12 AC 30 ms
8,580 KB
testcase_13 AC 44 ms
8,688 KB
testcase_14 AC 442 ms
13,412 KB
testcase_15 AC 63 ms
9,280 KB
testcase_16 AC 27 ms
8,568 KB
testcase_17 AC 539 ms
13,612 KB
testcase_18 AC 580 ms
13,420 KB
testcase_19 AC 144 ms
12,140 KB
testcase_20 AC 142 ms
11,664 KB
testcase_21 AC 54 ms
9,516 KB
testcase_22 AC 748 ms
13,140 KB
testcase_23 AC 17 ms
8,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect

def main():
    N = int(input())
    A, B = [], []
    apndA, apndB = A.append, B.append
    for i in range(N):
        a, b = map(int, input().split())
        apndA((a, i))
        apndB((b, i))
    M = int(input())
    XY = tuple(tuple(map(int, input().split())) for _ in [0] * M)

    a, b = sorted(A), sorted(B)
    a = list(map(lambda *x: x, *a))
    b = list(map(lambda *x: x, *b))
    men = [0] * M
    for i, (x, y) in enumerate(XY):
        j = bisect.bisect_left(a[0], x)
        seta = set(a[1][j:])
        j = bisect.bisect(b[0], y)
        setb = set(b[1][:j])
        men[i] += len(seta & setb)

    max_ = max(men)
    if not max_:
        print(0)
    else:
        for i in [j for j, k in enumerate(men) if k == max_]:
            print(i + 1)

main()
0