結果

問題 No.905 Sorted?
ユーザー 👑 rin204rin204
提出日時 2022-01-19 00:07:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 373 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 94,876 KB
最終ジャッジ日時 2023-08-15 07:46:16
合計ジャッジ時間 8,109 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
70,956 KB
testcase_01 AC 71 ms
71,136 KB
testcase_02 AC 71 ms
70,996 KB
testcase_03 AC 71 ms
70,992 KB
testcase_04 AC 70 ms
71,016 KB
testcase_05 AC 86 ms
76,356 KB
testcase_06 AC 79 ms
75,940 KB
testcase_07 AC 98 ms
76,668 KB
testcase_08 AC 350 ms
84,648 KB
testcase_09 AC 280 ms
83,112 KB
testcase_10 AC 320 ms
94,188 KB
testcase_11 AC 351 ms
88,548 KB
testcase_12 AC 373 ms
87,204 KB
testcase_13 AC 341 ms
94,652 KB
testcase_14 AC 345 ms
94,876 KB
testcase_15 AC 364 ms
91,512 KB
testcase_16 AC 359 ms
92,048 KB
testcase_17 AC 370 ms
92,332 KB
testcase_18 AC 316 ms
92,276 KB
testcase_19 AC 68 ms
70,856 KB
testcase_20 AC 67 ms
70,848 KB
testcase_21 AC 71 ms
70,756 KB
testcase_22 AC 69 ms
71,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

    if inc[r] - inc[l] == r - l:
        f = 1
    else:
        f = 0
    if dec[r] - dec[l] == r - l:
        g = 1
    else:
        g = 0
    print(f, g)
        
    
0