結果

問題 No.905 Sorted?
コンテスト
ユーザー pluto77
提出日時 2019-11-05 11:50:20
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 376 ms / 2,000 ms
コード長 422 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 167 ms
コンパイル使用メモリ 77,488 KB
最終ジャッジ日時 2025-12-04 01:57:10
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#yuki905

n=int(raw_input())
a=map(int,raw_input().split())
inc=[0]*n
dec=[0]*n
cnt=0
for i in range(1,n):
 if a[i]-a[i-1]>=0:
  cnt+=1
  inc[i]=cnt
 else:
  cnt=0
cnt=0
for i in range(1,n):
 if a[i]-a[i-1]<=0:
  cnt+=1
  dec[i]=cnt
 else:
  cnt=0
q=int(raw_input())
for i in range(q):
 l,r=map(int,raw_input().split())
 res=[0,0]
 if inc[r]-inc[l]==r-l:
  res[0]=1
 if dec[r]-dec[l]==r-l:
  res[1]=1
 print res[0],res[1]
0