結果

問題 No.2283 Prohibit Three Consecutive
ユーザー sepa38sepa38
提出日時 2023-04-28 21:48:25
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 79,196 KB
最終ジャッジ日時 2024-04-28 23:26:33
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 43 ms
51,712 KB
testcase_02 AC 42 ms
51,584 KB
testcase_03 AC 44 ms
53,504 KB
testcase_04 AC 51 ms
60,672 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 57 ms
68,480 KB
testcase_09 AC 57 ms
68,352 KB
testcase_10 AC 57 ms
68,352 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
  n = int(input())
  s = input()
  ans = "Yes"
  for j in range(n):
    i = (j - 1) % n
    k = (j + 1) % n
    tmp = s[i] + s[j] + s[k]
    if tmp == "0" * 3 or tmp == "1" * 3:
      ans = "No"
      break
    elif s[i-1] == s[i] != "?" and s[j] == "?" and s[k] == s[(k+1)%n] != "?" and s[i] != s[k]:
      ans = "No"
      break
  print(ans)
0