結果
| 問題 |
No.1694 ZerOne
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 19:14:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 942 bytes |
| コンパイル時間 | 334 ms |
| コンパイル使用メモリ | 81,996 KB |
| 実行使用メモリ | 104,252 KB |
| 最終ジャッジ日時 | 2025-06-12 19:14:35 |
| 合計ジャッジ時間 | 4,093 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 30 |
ソースコード
def count_unique_strings(s):
visited = set()
from collections import deque
q = deque()
q.append(s)
visited.add(s)
n = len(s)
while q:
current = q.popleft()
for i in range(n):
for j in range(i+1, n+1):
t = current[i:j]
for k in range(j+1, n):
for l in range(k+1, n+1):
u = current[k:l]
if len(t) == 0 or len(u) == 0:
continue
if (t.count('0') == u.count('0') and
t.count('1') == u.count('1')):
new_s = current[:i] + u + current[j:k] + t + current[l:]
if new_s not in visited:
visited.add(new_s)
q.append(new_s)
return len(visited)
s = input().strip()
print(count_unique_strings(s))
gew1fw