結果

問題 No.2343 (l+r)/2
ユーザー とりゐとりゐ
提出日時 2023-06-09 23:36:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 615 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 2,138 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 96,060 KB
最終ジャッジ日時 2023-08-30 14:44:51
合計ジャッジ時間 4,105 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,320 KB
testcase_01 AC 615 ms
78,880 KB
testcase_02 AC 121 ms
77,732 KB
testcase_03 AC 215 ms
79,028 KB
testcase_04 AC 89 ms
86,712 KB
testcase_05 AC 79 ms
78,544 KB
testcase_06 AC 79 ms
77,412 KB
testcase_07 AC 88 ms
78,016 KB
testcase_08 AC 90 ms
77,736 KB
testcase_09 AC 86 ms
77,440 KB
testcase_10 AC 80 ms
78,036 KB
testcase_11 AC 98 ms
91,252 KB
testcase_12 AC 93 ms
87,592 KB
testcase_13 AC 87 ms
82,332 KB
testcase_14 AC 104 ms
96,060 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(n,a):
  if a[0]!=a[-1]:
    return True
  for i in range(n-1):
    if a[i]==a[i+1]==1-a[0]:
      return True
  res=[a[0]]
  for i in a[1:]:
    if res[-1]!=i:
      res.append(i)
  return len(res)>=9


for _ in range(int(input())):
  n=int(input())
  a=list(map(int,input().split()))
  if solve(n,a):
    print('Yes')
  else:
    print('No')
0