結果
問題 |
No.2518 Adjacent Larger
|
ユーザー |
![]() |
提出日時 | 2023-10-27 22:52:47 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 219 ms |
コンパイル使用メモリ | 82,472 KB |
実行使用メモリ | 104,228 KB |
最終ジャッジ日時 | 2024-09-25 14:54:32 |
合計ジャッジ時間 | 4,644 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 WA * 17 |
ソースコード
import collections T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) C = collections.Counter(A) ans = C[0]==C[2] and C[1]<N temp = 0 for i in range(N): if A[i]==A[i-1] and A[i]!=1: ans = False temp+=A[i]-1 if not (temp==A[0]-1 or 0==temp): ans = False if ans: print('Yes') else: print('No')