結果

問題 No.1368 サイクルの中に眠る門松列
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-01-29 22:37:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 309 bytes
コンパイル時間 910 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 112,532 KB
最終ジャッジ日時 2023-09-09 16:10:23
合計ジャッジ時間 4,071 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,188 KB
testcase_01 AC 71 ms
71,408 KB
testcase_02 AC 213 ms
79,436 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 163 ms
111,656 KB
testcase_06 WA -
testcase_07 AC 133 ms
112,532 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    a = a+a[:2]
    dp = [0]*(n+5)
    for i in range(n):
        x = a[i:i+3]
        if len(set(x)) == 3 and (min(x) == x[1] or max(x) == x[1]):
            dp[i+3] = max(dp[i+3],dp[i]+a[i])
    print(max(dp)) 
0