結果

問題 No.905 Sorted?
ユーザー 👑 KazunKazun
提出日時 2020-07-04 17:34:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 81,404 KB
実行使用メモリ 97,232 KB
最終ジャッジ日時 2023-10-19 09:24:51
合計ジャッジ時間 7,351 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,152 KB
testcase_01 AC 40 ms
53,152 KB
testcase_02 AC 40 ms
53,152 KB
testcase_03 AC 40 ms
53,152 KB
testcase_04 AC 40 ms
53,152 KB
testcase_05 AC 59 ms
66,036 KB
testcase_06 AC 51 ms
61,864 KB
testcase_07 AC 74 ms
72,404 KB
testcase_08 AC 346 ms
85,060 KB
testcase_09 AC 258 ms
83,300 KB
testcase_10 AC 312 ms
96,392 KB
testcase_11 AC 334 ms
89,656 KB
testcase_12 AC 372 ms
88,096 KB
testcase_13 AC 333 ms
96,992 KB
testcase_14 AC 345 ms
97,232 KB
testcase_15 AC 367 ms
93,860 KB
testcase_16 AC 364 ms
94,528 KB
testcase_17 AC 359 ms
94,492 KB
testcase_18 AC 323 ms
94,492 KB
testcase_19 AC 38 ms
53,156 KB
testcase_20 AC 38 ms
53,156 KB
testcase_21 AC 38 ms
53,156 KB
testcase_22 AC 40 ms
53,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=[-10*10]+list(map(int,input().split()))+[10**10]

F=[0]*(N+1)
for i in range(1,N+1):
    if A[i]>=A[i-1]:
        F[i]=F[i-1]+1
    else:
        F[i]=1
F=F[1:]

G=[0]*(N+1)
for i in range(1,N+1):
    if A[i]<=A[i-1]:
        G[i]=G[i-1]+1
    else:
        G[i]=1
G=G[1:]

Q=int(input())
for _ in range(Q):
    l,r=map(int,input().split())

    f=1*(r-l==F[r]-F[l])
    g=1*(r-l==G[r]-G[l])

    print(f,g)
0