結果

問題 No.875 Range Mindex Query
ユーザー daku9640daku9640
提出日時 2019-09-06 22:42:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,235 bytes
コンパイル時間 113 ms
コンパイル使用メモリ 10,960 KB
実行使用メモリ 41,316 KB
最終ジャッジ日時 2023-09-07 01:36:07
合計ジャッジ時間 9,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
29,768 KB
testcase_01 AC 137 ms
29,760 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 131 ms
29,872 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 AC 135 ms
29,820 KB
testcase_09 RE -
testcase_10 AC 141 ms
29,724 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
INF = 100001
def solve():
    n, q = map(int, input().split())
    A = np.asarray([INF] + list(map(int, input().split())) + [INF])
    M = []
    flg = True
    for _ in range(q):
        c, l, r = map(int, input().split())
        if c == 1:
            A[l], A[r] = A[r], A[l]
            flg = False
        else:
            if flg:
                x = [n + 1, -1, 0]
                for a, b, m in M:
                    if l <= a and b <= r:
                        if A[x[-1]] > A[m]:
                            x[-1] = m
                        x[0] = min(x[0], a)
                        x[1] = max(x[1], b)
                if x[1] != -1:
                    a, b, m = x
                    l2 = l + np.argmin(A[l:a])
                    r2 = b + np.argmin(A[b:r + 1])
                    z = min([A[l2], l2], [A[r2], r2], [A[m], m])
                    M.append([l, r, z[1]])
                    print(z[1])
                else:
                    m = l + np.argmin(A[l:r + 1])
                    M.append([l, r, m])
                    print(m)
            else:
                flg = True
                m = l + np.argmin(A[l:r + 1])
                M = [[l, r, m]]
                print(m)
solve()
0