結果
問題 | No.905 Sorted? |
ユーザー |
![]() |
提出日時 | 2019-10-11 21:28:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 50 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 2,109 ms |
コンパイル使用メモリ | 194,744 KB |
最終ジャッジ日時 | 2025-01-07 21:31:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; using Int = long long; template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;} struct FastIO{ FastIO(){ cin.tie(0); ios::sync_with_stdio(0); } }fastio_beet; //INSERT ABOVE HERE signed main(){ Int n; cin>>n; vector<Int> as(n); for(Int i=0;i<n;i++) cin>>as[i]; vector<Int> fs(n,1),gs(n,1); for(Int i=0;i<n;i++){ if(i==0) continue; if(as[i-1]<=as[i]) fs[i]=fs[i-1]+1; if(as[i-1]>=as[i]) gs[i]=gs[i-1]+1; } Int q; cin>>q; for(Int i=0;i<q;i++){ Int l,r; cin>>l>>r; Int len=r-l+1; cout<<(fs[r]>=len)<<" "<<(gs[r]>=len)<<"\n"; } cout<<flush; return 0; }