結果

問題 No.127 門松もどき
ユーザー yaoshimaxyaoshimax
提出日時 2015-04-26 08:49:23
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 538 bytes
コンパイル時間 2,738 ms
コンパイル使用メモリ 77,628 KB
実行使用メモリ 214,872 KB
最終ジャッジ日時 2023-09-18 11:40:19
合計ジャッジ時間 11,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,064 KB
testcase_01 AC 75 ms
76,332 KB
testcase_02 AC 74 ms
76,120 KB
testcase_03 AC 74 ms
76,124 KB
testcase_04 AC 594 ms
214,800 KB
testcase_05 AC 74 ms
76,240 KB
testcase_06 AC 136 ms
90,868 KB
testcase_07 AC 90 ms
78,908 KB
testcase_08 AC 81 ms
78,484 KB
testcase_09 AC 80 ms
78,300 KB
testcase_10 AC 75 ms
76,556 KB
testcase_11 AC 95 ms
79,240 KB
testcase_12 AC 380 ms
154,336 KB
testcase_13 AC 481 ms
179,720 KB
testcase_14 AC 413 ms
168,960 KB
testcase_15 AC 580 ms
206,468 KB
testcase_16 AC 427 ms
168,364 KB
testcase_17 AC 460 ms
182,196 KB
testcase_18 AC 384 ms
164,296 KB
testcase_19 AC 271 ms
123,084 KB
testcase_20 AC 273 ms
132,868 KB
testcase_21 AC 182 ms
100,092 KB
testcase_22 WA -
testcase_23 AC 645 ms
214,856 KB
testcase_24 AC 480 ms
187,596 KB
testcase_25 AC 553 ms
207,696 KB
testcase_26 AC 317 ms
142,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(raw_input())
A=map(int,raw_input().split())
dpL=[[1 for j in range(N)] for k in range(N)]
dpR=[[1 for j in range(N)] for k in range(N)]
ans=1
for d in range(1,N):
    for l in range(N-d):
        # update l,l+d
        if A[l]<A[l+d]:
            dpL[l][l+d]=max(dpL[l][l+d-1],dpR[l+1][l+d]+1)
            dpR[l][l+d]=dpR[l+1][l+d]
        if A[l]>A[l+d]:
            dpL[l][l+d]=dpL[l][l+d-1]
            dpR[l][l+d]=max(dpR[l+1][l+d],dpL[l][l+d-1]+1)
        ans=max(ans,dpL[l][l+d])
        ans=max(ans,dpR[l][l+d])

print ans


0