結果

問題 No.647 明太子
ユーザー GrayCoderGrayCoder
提出日時 2018-02-12 07:59:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 523 ms / 4,500 ms
コード長 780 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,864 KB
実行使用メモリ 10,012 KB
最終ジャッジ日時 2023-09-09 09:32:41
合計ジャッジ時間 3,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,052 KB
testcase_01 AC 16 ms
8,060 KB
testcase_02 AC 16 ms
8,116 KB
testcase_03 AC 18 ms
8,052 KB
testcase_04 AC 17 ms
8,056 KB
testcase_05 AC 17 ms
8,044 KB
testcase_06 AC 16 ms
8,120 KB
testcase_07 AC 17 ms
8,056 KB
testcase_08 AC 16 ms
8,048 KB
testcase_09 AC 24 ms
8,128 KB
testcase_10 AC 30 ms
8,172 KB
testcase_11 AC 19 ms
7,988 KB
testcase_12 AC 29 ms
8,056 KB
testcase_13 AC 44 ms
8,616 KB
testcase_14 AC 404 ms
9,656 KB
testcase_15 AC 57 ms
8,464 KB
testcase_16 AC 26 ms
8,076 KB
testcase_17 AC 506 ms
9,764 KB
testcase_18 AC 523 ms
9,812 KB
testcase_19 AC 47 ms
9,700 KB
testcase_20 AC 41 ms
9,420 KB
testcase_21 AC 27 ms
8,460 KB
testcase_22 AC 151 ms
10,012 KB
testcase_23 AC 17 ms
8,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
import heapq

def main():
    N = int(input())
    AB = []
    for i in (tuple(map(int, input().split())) for _ in [0] * N):
        heapq.heappush(AB, i)
    M = int(input())
    XY = tuple(tuple(map(int, input().split())) for _ in [0] * M)

    a = [0] * N
    b = a[:]
    for i in range(N):
        a[i], b[i] = heapq.heappop(AB)

    men = [0] * M
    for i, (x, y) in enumerate(XY):
        j = bisect.bisect_left(a, x)
        b_ = b[j:]
        b_.sort()
        k = bisect.bisect(b_, y)
        men[i] += k

    max_ = max(men)
    if not max_:
        print(0)
    else:
        i = 0
        try:
            while 1:
                j = men.index(max_, i)
                print(j + 1)
                i = j + 1
        except:
            return

main()
0