結果

問題 No.905 Sorted?
ユーザー kawacchukawacchu
提出日時 2019-10-11 22:42:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 248 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 21,776 KB
最終ジャッジ日時 2023-08-16 18:56:47
合計ジャッジ時間 8,911 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 21 ms
8,616 KB
testcase_06 AC 17 ms
8,264 KB
testcase_07 AC 28 ms
9,096 KB
testcase_08 WA -
testcase_09 AC 386 ms
13,492 KB
testcase_10 WA -
testcase_11 AC 607 ms
17,080 KB
testcase_12 AC 708 ms
16,368 KB
testcase_13 AC 592 ms
21,592 KB
testcase_14 AC 600 ms
21,776 KB
testcase_15 AC 730 ms
17,276 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 535 ms
19,596 KB
testcase_19 AC 15 ms
8,164 KB
testcase_20 AC 16 ms
8,228 KB
testcase_21 AC 16 ms
8,192 KB
testcase_22 AC 15 ms
8,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))

dec = [1]*N
c = 1
f = True
for i in range(1,N) :
    if A[i-1] >= A[i] :
        if not f :
            f = True
            c += 1
            dec[i-1] = c
            dec[i] = c
        else :
            dec[i] = c
    else :
        dec[i] = False
        f = False



inc = [1]*N
c = 1
f = True
for i in range(1,N) :
    if A[i-1] <= A[i] :
        if not f :
            f = True
            c += 1
            inc[i-1] = c
            inc[i] = c
        else :
            inc[i] = c
    else :
        inc[i] = False
        f = False


for i in range(int(input())) :
    p,q = map(int,input().split())
    if (inc[p] == False) or (inc[q] == False) :
        x = 0
    elif inc[p] == inc[q] :
        x = 1
    else :
        x = 0
    
    if (dec[p] == False) or (dec[q] == False) :
        y = 0
        #print(p,q,dec[p],dec[q])
    elif dec[p] == dec[q] :
        y = 1
    else :
        y = 0
    
    print(x,y)
0