結果

問題 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
コンパイル時間 78 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 22,808 KB
最終ジャッジ日時 2024-05-04 02:27:58
合計ジャッジ時間 8,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 34 ms
11,136 KB
testcase_06 AC 32 ms
11,136 KB
testcase_07 AC 43 ms
11,776 KB
testcase_08 WA -
testcase_09 AC 394 ms
15,632 KB
testcase_10 WA -
testcase_11 AC 650 ms
19,132 KB
testcase_12 AC 753 ms
17,820 KB
testcase_13 AC 652 ms
22,808 KB
testcase_14 AC 645 ms
22,004 KB
testcase_15 AC 763 ms
18,524 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 628 ms
20,724 KB
testcase_19 AC 27 ms
10,752 KB
testcase_20 AC 27 ms
10,752 KB
testcase_21 AC 27 ms
10,752 KB
testcase_22 AC 26 ms
10,752 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