結果
問題 | No.2283 Prohibit Three Consecutive |
ユーザー | sepa38 |
提出日時 | 2023-04-28 21:53:52 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 462 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 81,280 KB |
最終ジャッジ日時 | 2024-04-28 23:29:56 |
合計ジャッジ時間 | 2,403 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
51,456 KB |
testcase_01 | AC | 42 ms
52,096 KB |
testcase_02 | AC | 47 ms
51,968 KB |
testcase_03 | AC | 67 ms
80,384 KB |
testcase_04 | AC | 73 ms
81,280 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 67 ms
76,800 KB |
testcase_09 | AC | 68 ms
76,800 KB |
testcase_10 | AC | 74 ms
79,232 KB |
testcase_11 | AC | 73 ms
79,360 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
for _ in range(int(input())): n = int(input()) s = list(map(str, 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 if s[i] == s[j] != "?": s[k] = str(1-int(s[j])) continue 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)