結果
| 問題 |
No.875 Range Mindex Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-06 22:00:42 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,196 bytes |
| コンパイル時間 | 366 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 50,032 KB |
| 最終ジャッジ日時 | 2024-06-24 17:52:43 |
| 合計ジャッジ時間 | 13,686 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | RE * 18 |
ソースコード
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 = l + np.argmin(A[b + 1: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()