結果

問題 No.701 ひとりしりとり
ユーザー sekihankamibanzsekihankamibanz
提出日時 2018-10-29 21:47:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 551 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 17,408 KB
最終ジャッジ日時 2024-04-29 23:21:46
合計ジャッジ時間 5,360 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
16,256 KB
testcase_01 AC 31 ms
11,008 KB
testcase_02 AC 31 ms
11,136 KB
testcase_03 AC 30 ms
11,008 KB
testcase_04 AC 28 ms
11,136 KB
testcase_05 AC 29 ms
11,136 KB
testcase_06 AC 31 ms
11,008 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 32 ms
11,008 KB
testcase_09 AC 48 ms
11,264 KB
testcase_10 AC 1,108 ms
11,648 KB
testcase_11 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import random


n = int(input())
used_words = []

for i in range(n):
    while True:
        
        if used_words:
            word = used_words[-1][-1] + ''.join([chr(97 + x) for x in random.choices(range(26), k=5)])
        else:
            word = ''.join([chr(97 + x) for x in random.choices(range(26), k=5)])
        if word[-1] == 'n' or word in used_words or ((i == n-1) and (len(word) == 20)):
            continue
        if i == n-1:
            word += 'n'
        used_words.append(word)
        break

for i in used_words:
    print(i)
0