結果
問題 |
No.1368 サイクルの中に眠る門松列
|
ユーザー |
|
提出日時 | 2021-01-29 22:37:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 309 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 82,244 KB |
実行使用メモリ | 111,256 KB |
最終ジャッジ日時 | 2024-06-27 08:57:26 |
合計ジャッジ時間 | 2,899 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 4 WA * 11 |
ソースコード
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))