結果

問題 No.905 Sorted?
ユーザー buriburi
提出日時 2019-10-13 19:08:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 358 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 31,560 KB
最終ジャッジ日時 2024-12-16 07:34:38
合計ジャッジ時間 15,220 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 16 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(k) for k in input().split()]
Q = int(input())
def main():
    for p in range(Q):
        x, y = [int(k) for k in input().split()]
        if (x == y):
            print("1 1")
        else:
            inc = True
            dec = True
            t = True
            for i in range(y - x -1):
                a ,b = A[i ], A[i + 1]
                if inc:
                    if a > b:
                        inc = False

                if dec:
                    if b > a:
                        dec = False
                if (not dec) and (not inc):
                    t = False
                    print("0 0")
                    break
            if t:
                if inc:
                    l = "1 "
                else:
                    l = '0 '
                if dec:
                    r = "1"
                else:
                    r = '0'
                print(l + r)

main()
0