結果

問題 No.905 Sorted?
ユーザー SalmonizeSalmonize
提出日時 2020-03-10 13:38:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 759 ms / 2,000 ms
コード長 331 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,736 KB
最終ジャッジ日時 2024-04-27 18:35:08
合計ジャッジ時間 9,379 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
10,752 KB
testcase_01 AC 25 ms
10,752 KB
testcase_02 AC 24 ms
10,880 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 25 ms
10,752 KB
testcase_05 AC 32 ms
11,136 KB
testcase_06 AC 29 ms
10,880 KB
testcase_07 AC 37 ms
11,776 KB
testcase_08 AC 637 ms
16,676 KB
testcase_09 AC 428 ms
16,332 KB
testcase_10 AC 601 ms
22,388 KB
testcase_11 AC 652 ms
20,164 KB
testcase_12 AC 751 ms
19,488 KB
testcase_13 AC 680 ms
22,736 KB
testcase_14 AC 642 ms
21,940 KB
testcase_15 AC 759 ms
21,168 KB
testcase_16 AC 731 ms
20,688 KB
testcase_17 AC 742 ms
20,668 KB
testcase_18 AC 584 ms
20,664 KB
testcase_19 AC 25 ms
10,752 KB
testcase_20 AC 25 ms
10,880 KB
testcase_21 AC 23 ms
10,752 KB
testcase_22 AC 25 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
l = [0]*n
h = [0]*n
for i in range(1,n):
    if a[i] < a[i-1]:
        l[i] += 1
    if a[i] > a[i-1]:
        h[i] += 1
    l[i] += l[i-1]
    h[i] += h[i-1]
q = int(input())
for _ in range(q):
    a,b = map(int, input().split())
    print(int(l[a] == l[b]), int(h[a] == h[b]))
0