結果

問題 No.905 Sorted?
ユーザー tails1434tails1434
提出日時 2019-12-25 21:11:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 370 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 2,512 ms
コンパイル使用メモリ 81,500 KB
実行使用メモリ 93,968 KB
最終ジャッジ日時 2023-10-26 04:06:45
合計ジャッジ時間 7,898 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,448 KB
testcase_01 AC 38 ms
53,448 KB
testcase_02 AC 37 ms
53,448 KB
testcase_03 AC 37 ms
53,448 KB
testcase_04 AC 37 ms
53,448 KB
testcase_05 AC 55 ms
64,116 KB
testcase_06 AC 46 ms
61,952 KB
testcase_07 AC 69 ms
70,636 KB
testcase_08 AC 334 ms
83,168 KB
testcase_09 AC 248 ms
81,900 KB
testcase_10 AC 302 ms
92,788 KB
testcase_11 AC 323 ms
87,012 KB
testcase_12 AC 370 ms
85,508 KB
testcase_13 AC 320 ms
93,968 KB
testcase_14 AC 332 ms
93,944 KB
testcase_15 AC 341 ms
89,672 KB
testcase_16 AC 333 ms
90,884 KB
testcase_17 AC 343 ms
90,848 KB
testcase_18 AC 281 ms
90,848 KB
testcase_19 AC 37 ms
53,448 KB
testcase_20 AC 37 ms
53,448 KB
testcase_21 AC 38 ms
53,448 KB
testcase_22 AC 36 ms
53,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    up = [0] * N
    down = [0] * N
    cnt = 0
    for i in range(N-1):
        if A[i] <= A[i+1]:
            cnt += 1
            up[i+1] = cnt
        else:
            cnt = 0

    cnt = 0
    for i in range(N-1):
        if A[i] >= A[i+1]:
            cnt += 1
            down[i+1] = cnt
        else:
            cnt = 0

    for _ in range(Q):
        l, r = map(int, input().split())
        f = up[r] - up[l]
        g = down[r] - down[l]
        ans = [0,0]
        if f == r - l:
            ans[0] = 1
        if g == r - l:
            ans[1] = 1
        print(*ans)

if __name__ == "__main__":
    main()
0