結果

問題 No.905 Sorted?
ユーザー buriburiburiburi
提出日時 2019-10-13 18:54:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 979 bytes
コンパイル時間 612 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 9,220 KB
最終ジャッジ日時 2023-08-22 10:54:54
合計ジャッジ時間 4,493 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,896 KB
testcase_01 AC 16 ms
7,772 KB
testcase_02 AC 16 ms
7,772 KB
testcase_03 AC 17 ms
7,796 KB
testcase_04 AC 16 ms
7,760 KB
testcase_05 AC 31 ms
8,504 KB
testcase_06 AC 19 ms
8,452 KB
testcase_07 AC 167 ms
9,220 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

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:
            check = A[x : y +1]
            inc = True
            dec = True
            t = True
            for i in range(len(check)-1):
                a ,b = check[i ], check[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