結果
問題 | No.875 Range Mindex Query |
ユーザー |
![]() |
提出日時 | 2019-09-07 02:34:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,020 bytes |
コンパイル時間 | 2,553 ms |
コンパイル使用メモリ | 166,876 KB |
実行使用メモリ | 13,880 KB |
最終ジャッジ日時 | 2024-06-25 01:59:42 |
合計ジャッジ時間 | 10,129 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 15 TLE * 1 -- * 2 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:32:19: warning: 'idx' may be used uninitialized [-Wmaybe-uninitialized] 32 | printf("%d\n",idx+1); | ~~~~~~^~~~~~~~~~~~~~ main.cpp:23:18: note: 'idx' was declared here 23 | int b,l,r,mi,idx; | ^~~
ソースコード
#define _USE_MATH_DEFINES #include <bits/stdc++.h> using namespace std; //template #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(a);i>(b);i--) #define ALL(v) (v).begin(),(v).end() typedef long long int ll; typedef pair<ll, ll> P; template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);} const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2; //template end int main(){ int n,q; scanf("%d%d",&n,&q); int a[100010]; rep(i,0,n)scanf("%d",&a[i]); int b,l,r,mi,idx; rep(rot,0,q){ scanf("%d%d%d",&b,&l,&r); if(b==1){ swap(a[l-1],a[r-1]); } else{ mi=inf; rep(i,l-1,r)if(chmin(mi,a[i]))idx=i; printf("%d\n",idx+1); } } return 0; }