結果

問題 No.3623 2-Letter Shiritori 2
コンテスト
ユーザー detteiuu
提出日時 2026-08-14 21:46:58
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 61 ms / 2,000 ms
+ 713µs
コード長 857 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,370 ms
コンパイル使用メモリ 95,344 KB
実行使用メモリ 82,736 KB
最終ジャッジ日時 2026-08-14 21:47:05
合計ジャッジ時間 1,552 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from types import GeneratorType

def bootstrap(f, stack=[]):
    def wrappedfunc(*args, **kwargs):
        if stack:
            return f(*args, **kwargs)
        to = f(*args, **kwargs)
        while True:
            if type(to) is GeneratorType:
                stack.append(to)
                to = next(to)
            else:
                stack.pop()
                if not stack:
                    break
                to = stack[-1].send(to)
        return to
    return wrappedfunc

def code(s):
    return ord(s)-ord("A")
def codeR(n):
    return chr(ord("A")+n)

@bootstrap
def dfs(n):
    while G[n]:
        v, s = G[n].pop()
        yield dfs(v)
        ans.append(s)
    yield

G = [[] for _ in range(26)]
for i in range(26):
    for j in range(26):
        G[i].append((j, codeR(j)+codeR(i)))

ans = []
dfs(0)

for a in ans:
    print(a)
0