結果
| 問題 |
No.2343 (l+r)/2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-09 21:59:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 524 bytes |
| コンパイル時間 | 553 ms |
| コンパイル使用メモリ | 82,684 KB |
| 実行使用メモリ | 86,512 KB |
| 最終ジャッジ日時 | 2025-01-02 03:02:01 |
| 合計ジャッジ時間 | 2,732 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 7 |
ソースコード
T = int(input())
for _ in range(T):
N = int(input())
A = list(map(int, input().split()))
cnt = 0
for a in A:
if a==1:
cnt+=1
if cnt*2==N:
print("Yes")
continue
if cnt>N-cnt:
sa = cnt - (N-cnt)
chk = 1
else:
sa = (N-cnt) - cnt
chk =0
tmp = 0
for i in range(N-1):
if A[i]==A[i+1]==chk:
tmp += 1
if tmp==sa:
break
if tmp==sa:
print("Yes")
else:
print("No")