結果

問題 No.759 悪くない忘年会にしような!
ユーザー H3PO4
提出日時 2021-01-21 15:18:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,229 ms / 2,000 ms
コード長 823 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 35,532 KB
最終ジャッジ日時 2024-12-24 15:21:58
合計ジャッジ時間 20,743 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 64
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline

SIZE_MAX = 10 ** 4 + 1
NUM_MAX = 10 ** 4 + 2


class Bit:
    """1-indexed"""

    def __init__(self, n):
        self.size = n
        self.tree = [NUM_MAX] * (n + 1)

    def min(self, i):
        m = NUM_MAX
        while i > 0:
            m = min(m, self.tree[i])
            i -= i & -i
        return m

    def update(self, i, x):
        while i <= self.size:
            self.tree[i] = min(x, self.tree[i])
            i += i & -i


N = int(input())
stores = []
for i in range(1, N + 1):
    p, t, r = map(int, input().split())
    stores.append((SIZE_MAX - p, SIZE_MAX - t, SIZE_MAX - r, i))
stores.sort()

BIT = Bit(SIZE_MAX)
ans = []
for _, t, r, i in stores:
    if BIT.min(t) > r:
        BIT.update(t, r)
        ans.append(i)
ans.sort()
print(*ans, sep='\n')
0