結果
| 問題 |
No.2283 Prohibit Three Consecutive
|
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2023-04-28 21:49:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 652 bytes |
| コンパイル時間 | 157 ms |
| コンパイル使用メモリ | 12,928 KB |
| 実行使用メモリ | 31,560 KB |
| 最終ジャッジ日時 | 2024-11-17 20:48:28 |
| 合計ジャッジ時間 | 7,514 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 1 WA * 12 |
ソースコード
for _ in range(int(input())):
n = int(input()); s = input(); ans = "No"
for i in range(4):
dp = [[False]*4 for _ in range(n)]; dp[1][i] = True
for j in range(2,n):
if s[j]!="1" and dp[j-1][2]: dp[j][0] = True
if s[j]!="0" and dp[-1][0]+dp[-1][2]: dp[j][1] = True
if s[j]!="1" and dp[-1][1]+dp[-1][3]: dp[j][2] = True
if s[j]!="0" and dp[j-1][1]: dp[j][3] = True
if i==0 and dp[-1][1]+dp[-1][3]: ans = "Yes"
if i==1 and sum(dp[-1][1:]): ans = "Yes"
if i==2 and sum(dp[-1][:3]): ans = "Yes"
if i==3 and dp[-1][0]+dp[-1][2]: ans = "Yes"
print(ans)
ニックネーム