結果
| 問題 |
No.875 Range Mindex Query
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-30 15:48:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 192 ms / 2,000 ms |
| コード長 | 820 bytes |
| コンパイル時間 | 1,870 ms |
| コンパイル使用メモリ | 200,348 KB |
| 最終ジャッジ日時 | 2025-02-26 09:39:14 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 18 |
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
#include<atcoder/segtree>
using namespace atcoder;
using S = pair<int,int>;
S op(S a, S b){
return min(a,b);
}
S e(){
return make_pair(1e9, -1);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n,q;
cin>>n>>q;
vector<pair<int,int>> a(n);
rep(i,n)cin>>a[i].first,a[i].second=i;
segtree<S,op,e> seg(a);
rep(qi,q){
int t,l,r;
cin>>t>>l>>r;
l--;r--;
if(t==1){
S a = seg.get(l);
S b = seg.get(r);
a.second=r;
b.second=l;
seg.set(l,b);
seg.set(r,a);
}
if(t==2){
cout <<seg.prod(l,r+1).second+1<<endl;
}
}
}