結果

問題 No.1675 Strange Minimum Query
ユーザー 👑 H20H20
提出日時 2021-09-10 22:32:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 533 bytes
コンパイル時間 420 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 123,684 KB
最終ジャッジ日時 2023-09-02 18:59:37
合計ジャッジ時間 12,197 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
75,596 KB
testcase_01 AC 70 ms
70,956 KB
testcase_02 AC 70 ms
71,232 KB
testcase_03 AC 810 ms
111,796 KB
testcase_04 AC 674 ms
106,732 KB
testcase_05 AC 123 ms
78,588 KB
testcase_06 AC 940 ms
116,116 KB
testcase_07 AC 1,003 ms
123,684 KB
testcase_08 AC 71 ms
71,348 KB
testcase_09 AC 91 ms
76,464 KB
testcase_10 AC 331 ms
93,840 KB
testcase_11 AC 134 ms
82,416 KB
testcase_12 AC 365 ms
97,552 KB
testcase_13 AC 334 ms
114,920 KB
testcase_14 AC 339 ms
117,928 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q = map(int, input().split())
L = []
inf = 10**9
for _ in range(Q):
    l,r,b=map(int, input().split())
    L.append([l-1,r-1,b])
L = sorted(L, key=lambda x: x[2])
L = sorted(L, key=lambda x: x[0])
L = sorted(L, key=lambda x: x[1])
ANS = [inf]*N
for l in L:
    l,r,b = l[0],l[1],l[2]
    for i in range(l,r+1):
        if ANS[i]==b:
            break
        if ANS[i]<b:
            print(-1)
            exit()
        if ANS[i]==inf:
            ANS[i]=b
            break
    else:
        print(-1)
        exit()
print(*ANS)
0