結果

問題 No.1675 Strange Minimum Query
ユーザー lloyzlloyz
提出日時 2021-11-23 22:34:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 10,952 KB
実行使用メモリ 70,084 KB
最終ジャッジ日時 2023-09-08 03:08:28
合計ジャッジ時間 22,689 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 AC 15 ms
8,092 KB
testcase_02 AC 16 ms
7,800 KB
testcase_03 AC 837 ms
59,084 KB
testcase_04 AC 677 ms
50,848 KB
testcase_05 AC 55 ms
11,892 KB
testcase_06 AC 1,000 ms
68,136 KB
testcase_07 AC 968 ms
69,344 KB
testcase_08 AC 15 ms
7,828 KB
testcase_09 AC 19 ms
8,412 KB
testcase_10 AC 448 ms
33,088 KB
testcase_11 AC 96 ms
12,748 KB
testcase_12 AC 499 ms
35,204 KB
testcase_13 AC 836 ms
61,280 KB
testcase_14 AC 891 ms
67,728 KB
testcase_15 WA -
testcase_16 AC 15 ms
7,932 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())
B = [list(map(int, input().split())) for _ in range(q)]

INF = 10**9
B.sort(key=lambda x: (x[0], x[1]))
A = [INF for _ in range(n)]
min_ind = -1
for i in range(q):
    l, r, b = B[i]
    l -= 1
    r -= 1
    if l != min_ind:
        min_ind = l
    else:
        if A[min_ind] < b:
            print(-1)
            exit()
        elif A[min_ind] == b:
            continue
        min_ind += 1
        if min_ind > r:
            print(-1)
            exit()
    A[min_ind] = b
print(*A)
0