結果
問題 | No.875 Range Mindex Query |
ユーザー | daku9640 |
提出日時 | 2019-09-06 22:12:44 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,204 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 10,932 KB |
実行使用メモリ | 41,564 KB |
最終ジャッジ日時 | 2023-09-07 00:34:56 |
合計ジャッジ時間 | 11,857 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 133 ms
29,652 KB |
testcase_01 | AC | 137 ms
29,668 KB |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | AC | 132 ms
29,636 KB |
testcase_06 | AC | 141 ms
29,700 KB |
testcase_07 | RE | - |
testcase_08 | AC | 134 ms
29,660 KB |
testcase_09 | RE | - |
testcase_10 | AC | 137 ms
29,776 KB |
testcase_11 | AC | 1,274 ms
38,768 KB |
testcase_12 | AC | 1,018 ms
35,960 KB |
testcase_13 | AC | 928 ms
40,160 KB |
testcase_14 | AC | 898 ms
40,180 KB |
testcase_15 | AC | 1,267 ms
40,300 KB |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
ソースコード
from collections import deque import numpy as np def solve(): n, q = map(int, input().split()) A = np.asarray([0] + list(map(int, input().split()))) 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 = [0, 0, 0, 0] for a, b, m in M: if l <= a and b <= r: t = min(b, r) - max(a, l) if x[0] < t: x = [t, a, b, m] if x[0] != 0: t, 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()