結果

問題 No.905 Sorted?
ユーザー vwxyzvwxyz
提出日時 2024-04-08 09:21:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 827 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 2,155 ms
コンパイル使用メモリ 11,776 KB
実行使用メモリ 23,484 KB
最終ジャッジ日時 2024-04-08 09:23:05
合計ジャッジ時間 17,666 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,112 KB
testcase_01 AC 29 ms
10,112 KB
testcase_02 AC 29 ms
10,112 KB
testcase_03 AC 28 ms
10,112 KB
testcase_04 AC 28 ms
10,112 KB
testcase_05 AC 35 ms
10,496 KB
testcase_06 AC 30 ms
10,240 KB
testcase_07 AC 42 ms
11,136 KB
testcase_08 AC 678 ms
16,556 KB
testcase_09 AC 476 ms
15,220 KB
testcase_10 AC 617 ms
22,304 KB
testcase_11 AC 692 ms
20,096 KB
testcase_12 AC 827 ms
19,208 KB
testcase_13 AC 698 ms
23,484 KB
testcase_14 AC 696 ms
23,476 KB
testcase_15 AC 801 ms
21,260 KB
testcase_16 AC 773 ms
21,468 KB
testcase_17 AC 799 ms
21,460 KB
testcase_18 AC 573 ms
21,460 KB
testcase_19 AC 28 ms
10,112 KB
testcase_20 AC 28 ms
10,112 KB
testcase_21 AC 28 ms
10,112 KB
testcase_22 AC 28 ms
10,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
lt=[0]+[int(A[i]<A[i+1]) for i in range(N-1)]
gt=[0]+[int(A[i]>A[i+1]) for i in range(N-1)]
for i in range(1,N):
    lt[i]+=lt[i-1]
    gt[i]+=gt[i-1]
Q=int(input())
for q in range(Q):
    L,R=map(int,input().split())
    f=int(gt[R]-gt[L]==0)
    g=int(lt[R]-lt[L]==0)
    print(f,g)
0