結果

問題 No.905 Sorted?
ユーザー sho_00sho_00
提出日時 2020-04-08 17:06:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 750 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 21,564 KB
最終ジャッジ日時 2023-09-25 21:15:13
合計ジャッジ時間 10,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,756 KB
testcase_01 AC 16 ms
7,752 KB
testcase_02 AC 16 ms
7,884 KB
testcase_03 AC 16 ms
7,876 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 AC 20 ms
8,484 KB
testcase_06 AC 18 ms
8,328 KB
testcase_07 AC 28 ms
9,180 KB
testcase_08 AC 620 ms
14,604 KB
testcase_09 AC 408 ms
13,452 KB
testcase_10 AC 558 ms
19,436 KB
testcase_11 AC 624 ms
17,136 KB
testcase_12 AC 727 ms
16,284 KB
testcase_13 AC 644 ms
21,564 KB
testcase_14 AC 648 ms
21,524 KB
testcase_15 AC 716 ms
17,344 KB
testcase_16 AC 750 ms
20,552 KB
testcase_17 AC 732 ms
19,424 KB
testcase_18 AC 533 ms
19,428 KB
testcase_19 AC 16 ms
7,880 KB
testcase_20 AC 16 ms
7,784 KB
testcase_21 AC 16 ms
7,780 KB
testcase_22 AC 16 ms
7,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
plus=[0]*n
minus=[0]*n
for i in range(1,n):
  if a[i-1]<=a[i]:
    plus[i]=(plus[i-1]+1)
  if a[i-1]>=a[i]:
    minus[i]=minus[i-1]+1

q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  if plus[r]-plus[l]==r-l:
    f=1
  else:
    f=0
  if minus[r]-minus[l]==r-l:
    g=1
  else:
    g=0
  print(' '.join([str(f),str(g)]))
0