結果
問題 |
No.1675 Strange Minimum Query
|
ユーザー |
|
提出日時 | 2021-09-11 19:20:32 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 299 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 115,716 KB |
最終ジャッジ日時 | 2024-06-23 03:47:34 |
合計ジャッジ時間 | 9,977 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 23 |
ソースコード
n,q = map(int,input().split()) lr = [[int(i)-1 for i in input().split()] for j in range(q)] lr.sort(key=lambda x:x[2], reverse=True) li = [10**9]*n s = set(i for i in range(n)) sm = set() for i in range(q): l,r,b = lr[i] if i > 0 and lr[i-1][2] != b: sm = set() a = set(l+i for i in range(r-l+1)) f = False for i in a&s: f = True li[i] = b+1 s.remove(i) sm.add(i) if f == False: if not sm&a: print(-1) exit() print(*li)