結果
| 問題 | No.1675 Strange Minimum Query |
| コンテスト | |
| ユーザー |
ygd.
|
| 提出日時 | 2021-09-12 10:12:59 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 905 bytes |
| 記録 | |
| コンパイル時間 | 239 ms |
| コンパイル使用メモリ | 85,724 KB |
| 実行使用メモリ | 212,164 KB |
| 最終ジャッジ日時 | 2026-03-09 06:08:06 |
| 合計ジャッジ時間 | 13,077 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 21 |
ソースコード
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()
ygd.