結果

問題 No.701 ひとりしりとり
ユーザー vwxyzvwxyz
提出日時 2024-04-13 15:47:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 927 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 82,092 KB
実行使用メモリ 196,732 KB
最終ジャッジ日時 2024-04-13 15:47:56
合計ジャッジ時間 12,763 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 915 ms
196,520 KB
testcase_01 AC 838 ms
196,364 KB
testcase_02 AC 916 ms
196,424 KB
testcase_03 AC 840 ms
196,360 KB
testcase_04 AC 922 ms
196,420 KB
testcase_05 AC 823 ms
196,212 KB
testcase_06 AC 896 ms
196,424 KB
testcase_07 AC 820 ms
196,420 KB
testcase_08 AC 848 ms
196,488 KB
testcase_09 AC 879 ms
196,532 KB
testcase_10 AC 927 ms
196,472 KB
testcase_11 AC 852 ms
196,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
queue={"a":[],"b":[]}
for bit in range(1,1<<20):
    S=""
    for i in range(20):
        if bit&1<<i:
            S+="a"
        else:
            S+="b"
    queue[S[0]].append(S)
ans="a"
for n in range(N):
    if n==N-1:
        ans=ans[:-1]+"n"
        print(ans)
        break
    print(ans)
    ans=queue[ans[-1]].pop()
0