結果
問題 |
No.2268 NGワード回避
|
ユーザー |
![]() |
提出日時 | 2023-04-14 23:40:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 485 bytes |
コンパイル時間 | 492 ms |
コンパイル使用メモリ | 81,888 KB |
実行使用メモリ | 77,492 KB |
最終ジャッジ日時 | 2024-10-10 14:45:22 |
合計ジャッジ時間 | 4,866 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 52 |
ソースコード
import random import collections N = int(input()) NG = [input() for _ in range(N)] WORD = collections.deque() for _ in range(N): if random.random()>0.5: WORD.append('a') else: WORD.append('b') while True: for ng in NG: if list(ng)==list(WORD):#滅茶苦茶重いはず break else: print(''.join(WORD)) exit() WORD.popleft() if random.random()>0.5: WORD.append('a') else: WORD.append('b')