結果

問題 No.1675 Strange Minimum Query
ユーザー 👑 H20H20
提出日時 2021-09-10 22:24:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 1,243 ms
コンパイル使用メモリ 85,984 KB
実行使用メモリ 124,024 KB
最終ジャッジ日時 2023-09-02 18:36:22
合計ジャッジ時間 21,128 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,280 KB
testcase_01 AC 74 ms
71,044 KB
testcase_02 AC 72 ms
71,120 KB
testcase_03 AC 872 ms
111,692 KB
testcase_04 AC 697 ms
107,344 KB
testcase_05 AC 127 ms
78,780 KB
testcase_06 AC 955 ms
115,900 KB
testcase_07 AC 1,093 ms
124,024 KB
testcase_08 AC 131 ms
70,968 KB
testcase_09 AC 97 ms
76,296 KB
testcase_10 AC 397 ms
93,012 KB
testcase_11 AC 140 ms
82,200 KB
testcase_12 AC 441 ms
97,524 KB
testcase_13 AC 342 ms
114,760 KB
testcase_14 AC 345 ms
117,568 KB
testcase_15 WA -
testcase_16 AC 75 ms
71,136 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 #

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[1])
L = sorted(L, key=lambda x: x[2])
L = sorted(L, key=lambda x: x[0])
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