結果

問題 No.1675 Strange Minimum Query
ユーザー H3PO4H3PO4
提出日時 2021-09-10 22:10:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 484 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 113,792 KB
最終ジャッジ日時 2023-09-02 18:02:47
合計ジャッジ時間 15,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,380 KB
testcase_01 AC 71 ms
71,196 KB
testcase_02 AC 69 ms
71,224 KB
testcase_03 AC 216 ms
86,372 KB
testcase_04 AC 216 ms
90,420 KB
testcase_05 WA -
testcase_06 AC 232 ms
88,148 KB
testcase_07 AC 246 ms
91,508 KB
testcase_08 AC 71 ms
71,300 KB
testcase_09 AC 85 ms
76,696 KB
testcase_10 AC 177 ms
97,104 KB
testcase_11 AC 117 ms
87,580 KB
testcase_12 AC 185 ms
98,776 KB
testcase_13 AC 255 ms
108,768 KB
testcase_14 AC 212 ms
113,792 KB
testcase_15 AC 316 ms
109,220 KB
testcase_16 AC 73 ms
71,528 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
import heapq

input = sys.stdin.buffer.readline

N, Q = map(int, input().split())
MAX = 10 ** 9
h = []
queries = [[] for _ in range(N)]
for _ in range(Q):
    l, r, b = map(int, input().split())
    l -= 1
    r -= 1
    queries[l].append((-b, r))

ans = [MAX] * N
for i in range(N):
    for q in queries[i]:
        heapq.heappush(h, q)
    if h:
        bm, r = heapq.heappop(h)
        if r < i: print(-1); exit()
        ans[i] = -bm
if h: print(-1);exit()
print(*ans)
0