結果

問題 No.1675 Strange Minimum Query
ユーザー ygd.ygd.
提出日時 2021-09-12 10:12:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 905 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 220,056 KB
最終ジャッジ日時 2023-09-06 03:34:37
合計ジャッジ時間 25,098 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
71,516 KB
testcase_01 AC 91 ms
71,584 KB
testcase_02 AC 90 ms
71,344 KB
testcase_03 AC 496 ms
132,476 KB
testcase_04 AC 482 ms
136,368 KB
testcase_05 WA -
testcase_06 AC 520 ms
144,632 KB
testcase_07 AC 629 ms
154,260 KB
testcase_08 AC 90 ms
71,584 KB
testcase_09 AC 108 ms
77,416 KB
testcase_10 AC 327 ms
135,848 KB
testcase_11 AC 164 ms
108,332 KB
testcase_12 AC 364 ms
145,252 KB
testcase_13 AC 523 ms
167,192 KB
testcase_14 AC 495 ms
183,032 KB
testcase_15 AC 820 ms
220,056 KB
testcase_16 AC 105 ms
71,552 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import defaultdict 
from heapq import heapify, heappop, heappush, nlargest

def main():
    N,Q = map(int,input().split()); INF = pow(10,9)
    L = defaultdict(list)
    R = defaultdict(list)
    comp = set([])
    query = []
    PQ = []
    for i in range(Q):
        l,r,b = map(int,input().split())
        l -= 1; r -= 1 #0-index
        L[l].append((b,i))
        R[r].append((b,i))
        comp.add(b)
        query.append((l,r,b))

    ans = [INF]*N
    i = 0
    PQ = []
    while i < N:
        for b,idx in L[i]:
            heappush(PQ,(-b,idx)) #-Minとクエリ番号
        if PQ:
            b,idx = heappop(PQ)
            b *= -1
            if query[idx][1] < i: #この制約を満たせていない
                print(-1);exit()
            ans[i] = b
        i += 1
    print(*ans)

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