結果
問題 |
No.875 Range Mindex Query
|
ユーザー |
|
提出日時 | 2019-09-06 22:10:03 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,222 bytes |
コンパイル時間 | 234 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 50,168 KB |
最終ジャッジ日時 | 2024-06-24 18:07:20 |
合計ジャッジ時間 | 12,596 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | RE * 18 |
ソースコード
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 b < l or r < a: continue 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()