結果
| 問題 | No.875 Range Mindex Query |
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2024-03-05 04:17:07 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 32 ms / 2,000 ms |
| コード長 | 817 bytes |
| 記録 | |
| コンパイル時間 | 4,260 ms |
| コンパイル使用メモリ | 375,220 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-16 01:03:45 |
| 合計ジャッジ時間 | 6,645 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
const int INF=1e9;
int op(int x,int y){return min(x,y);}
int e(){return INF;}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n,q;
cin>>n>>q;
vector<int> A(n),B(n);
rep(i,n){
cin>>A[i];
A[i]--;
B[A[i]]=i;
}
segtree<int,op,e> seg(A);
while(q--){
int c;
cin>>c;
if(c==1){
int l,r;
cin>>l>>r;
l--,r--;
int a=seg.get(l),b=seg.get(r);
seg.set(l,b),seg.set(r,a);
B[a]=r,B[b]=l;
}
else{
int l,r;
cin>>l>>r;
l--,r--;
auto c=seg.prod(l,r+1);
cout<<B[c]+1<<'\n';
}
}
return 0;
}
umezo