結果
| 問題 | No.905 Sorted? |
| コンテスト | |
| ユーザー |
season1618
|
| 提出日時 | 2019-10-11 22:54:52 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 804 bytes |
| 記録 | |
| コンパイル時間 | 1,234 ms |
| コンパイル使用メモリ | 180,304 KB |
| 実行使用メモリ | 13,056 KB |
| 最終ジャッジ日時 | 2026-05-19 22:22:08 |
| 合計ジャッジ時間 | 7,569 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 1 -- * 12 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=1e5;
const int INF=1e9;
int d[size];
bool f(int l,int r){
if(l==r) return true;
else if(l+1==r) return d[l]>=0;
return f(l,(l+r)/2)&&f((l+r)/2,r);
}
bool g(int l,int r){
if(l==r) return true;
else if(l+1==r) return d[l]<=0;
return g(l,(l+r)/2)&&g((l+r)/2,r);
}
int main(){
int N;cin>>N;
long a,b;cin>>a;
rep(i,1,N){
cin>>b;
if(a<b) d[i-1]=1;
else if(a==b) d[i-1]=0;
else d[i-1]=-1;
a=b;
}
int Q;cin>>Q;
int l,r;
rep(i,0,Q){
cin>>l>>r;
cout<<f(l,r)<<" "<<g(l,r)<<endl;
}//print(d,N-1);
}
season1618