結果
| 問題 |
No.905 Sorted?
|
| コンテスト | |
| ユーザー |
season1618
|
| 提出日時 | 2019-10-11 22:54:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 804 bytes |
| コンパイル時間 | 1,579 ms |
| コンパイル使用メモリ | 167,696 KB |
| 実行使用メモリ | 13,636 KB |
| 最終ジャッジ日時 | 2024-11-25 08:54:52 |
| 合計ジャッジ時間 | 19,561 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 18 TLE * 5 |
ソースコード
#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