結果
問題 | No.1368 サイクルの中に眠る門松列 |
ユーザー | 👑 timi |
提出日時 | 2021-03-05 15:24:23 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 836 bytes |
コンパイル時間 | 255 ms |
コンパイル使用メモリ | 13,056 KB |
実行使用メモリ | 60,372 KB |
最終ジャッジ日時 | 2024-04-16 03:27:21 |
合計ジャッジ時間 | 14,936 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
11,136 KB |
testcase_01 | AC | 32 ms
11,008 KB |
testcase_02 | AC | 435 ms
11,136 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 1,406 ms
51,028 KB |
testcase_06 | WA | - |
testcase_07 | AC | 288 ms
34,264 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 | - |
ソースコード
T=int(input()) for i in range(T): N=int(input()) A=list(map(int, input().split())) A=A+A B=A[1:]+A[:1] C=A[2:]+A[:2] a,b,c=0,0,0 DA=[0]*(N+1) DB=[0]*(N+1) DC=[0]*(N+1) for j in range(2,N): if A[j-2]!=A[j-1] and A[j-1]!=A[j] and A[j-2]!=A[j]: if max(A[j-2],A[j-1],A[j])==A[j-1] or min(A[j-2],A[j-1],A[j])==A[j-1]: DA[j+1]=max(DA[j+1],DA[j-2]+A[j-2]) for j in range(2,N): if B[j-2]!=B[j-1] and B[j-1]!=B[j] and B[j-2]!=B[j]: if max(B[j-2],B[j-1],B[j])==B[j-1] or min(B[j-2],B[j-1],B[j])==B[j-1]: DB[j+1]=max(DB[j+1],DB[j-2]+B[j-2]) for j in range(2,N): if C[j-2]!=C[j-1] and C[j-1]!=C[j] and C[j-2]!=C[j]: if max(C[j-2],C[j-1],C[j])==C[j-1] or min(C[j-2],C[j-1],C[j])==C[j-1]: DC[j+1]=max(DC[j+1],DC[j-2]+C[j-2]) print(max(max(DA),max(DB),max(DC)))