結果

問題 No.1675 Strange Minimum Query
ユーザー lloyzlloyz
提出日時 2021-11-23 22:30:39
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 495 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 69,860 KB
最終ジャッジ日時 2023-09-08 03:03:56
合計ジャッジ時間 24,480 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
8,048 KB
testcase_02 AC 18 ms
7,720 KB
testcase_03 AC 811 ms
58,868 KB
testcase_04 AC 689 ms
50,732 KB
testcase_05 AC 56 ms
11,780 KB
testcase_06 AC 979 ms
68,104 KB
testcase_07 AC 957 ms
69,416 KB
testcase_08 AC 15 ms
7,800 KB
testcase_09 AC 19 ms
8,376 KB
testcase_10 AC 435 ms
33,112 KB
testcase_11 AC 94 ms
12,608 KB
testcase_12 AC 487 ms
35,132 KB
testcase_13 AC 871 ms
61,368 KB
testcase_14 AC 878 ms
67,808 KB
testcase_15 WA -
testcase_16 AC 15 ms
7,860 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 b > A[min_ind]:
            print(-1)
            exit()
        min_ind += 1
        if min_ind > r:
            print(-1)
            exit()
    A[min_ind] = b
print(*A)
0