結果
問題 |
No.2343 (l+r)/2
|
ユーザー |
![]() |
提出日時 | 2023-06-09 23:16:27 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 493 ms |
コンパイル使用メモリ | 82,168 KB |
実行使用メモリ | 85,728 KB |
最終ジャッジ日時 | 2025-01-02 05:22:34 |
合計ジャッジ時間 | 2,975 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 8 |
ソースコード
def solve(N,A): last=A[0] lis=[] streak=0 for i in range(N): if last!=A[i]: lis.append(streak) streak=1 last=A[i] else: streak+=1 lis.append(streak) if A.count(1)==0 or A.count(0)==0: return False if len(lis)%2==1 and lis[1:-1].count(1)==len(lis)-2: return False return True T=int(input()) for _ in range(T): N=int(input()) A=list(map(int,input().split())) if solve(N,A): print('Yes') else: print('No')