結果
| 問題 |
No.2343 (l+r)/2
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2023-06-09 22:48:18 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 539 bytes |
| コンパイル時間 | 234 ms |
| コンパイル使用メモリ | 82,768 KB |
| 実行使用メモリ | 85,496 KB |
| 最終ジャッジ日時 | 2025-01-02 04:25:04 |
| 合計ジャッジ時間 | 2,547 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.count(1)==len(lis):
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')
nikoro256