結果

問題 No.905 Sorted?
ユーザー hir355hir355
提出日時 2020-04-03 17:43:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 789 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 10,908 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2023-09-15 23:46:03
合計ジャッジ時間 11,918 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 17 ms
7,940 KB
testcase_02 AC 16 ms
7,940 KB
testcase_03 AC 18 ms
7,836 KB
testcase_04 AC 18 ms
7,812 KB
testcase_05 AC 22 ms
8,508 KB
testcase_06 AC 18 ms
8,208 KB
testcase_07 AC 30 ms
9,316 KB
testcase_08 AC 651 ms
14,776 KB
testcase_09 AC 436 ms
14,344 KB
testcase_10 AC 604 ms
19,764 KB
testcase_11 AC 655 ms
17,808 KB
testcase_12 AC 760 ms
16,704 KB
testcase_13 AC 667 ms
21,636 KB
testcase_14 AC 700 ms
21,760 KB
testcase_15 AC 780 ms
18,692 KB
testcase_16 AC 764 ms
20,376 KB
testcase_17 AC 789 ms
19,508 KB
testcase_18 AC 565 ms
19,608 KB
testcase_19 AC 16 ms
7,856 KB
testcase_20 AC 16 ms
7,984 KB
testcase_21 AC 16 ms
7,796 KB
testcase_22 AC 16 ms
7,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
p = [0] * n
q = [0] * n
for i in range(n - 1):
    if a[i] <= a[i + 1]:
        p[i + 1] = 1
    if a[i] >= a[i + 1]:
        q[i + 1] = 1
    p[i + 1] += p[i]
    q[i + 1] += q[i]
qe = int(input())
for _ in range(qe):
    l, r = map(int, input().split())
    if p[r] - p[l] == r - l:
        print(1, end=' ')
    else:
        print(0, end=' ')
    if q[r] - q[l] == r - l:
        print(1)
    else:
        print(0)
0