結果
問題 |
No.2518 Adjacent Larger
|
ユーザー |
![]() |
提出日時 | 2023-10-27 22:15:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,082 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 104,104 KB |
最終ジャッジ日時 | 2024-09-25 14:18:39 |
合計ジャッジ時間 | 5,038 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 WA * 7 |
ソースコード
# 実験してみると # 和がNであり、0が常に1つ以上あり、マックスが2である必要ある # さらに2は連続できない、0も連続できない # WA, 010もありえない T = int(input()) for t in range(T): N = int(input()) A = list(map(int, input().split())) zero_test = False max_test = True sum_test = False if sum(A)==N: sum_test = True for a in A: if a == 0: zero_test = True if a > 2: max_test = False zero_consec_test = True two_consec_test = True zeroonezero_test = True for i in range(N): if A[(i-1)%N]==2 and A[i]==2: two_consec_test = False if A[(i-1)%N]==0 and A[i]==0: zero_consec_test = False if A[(i-2)%N]==0 and A[(i-1)%N]==1 and A[(i)%N]==0: zeroonezero_test = False ans = 'No' if sum_test == True and zero_test == True and max_test == True: if zero_consec_test == True and two_consec_test == True and zeroonezero_test == True: ans = 'Yes' print(ans)