結果

問題 No.548 国士無双
ユーザー mokrai
提出日時 2017-11-10 15:00:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-17 13:48:26
合計ジャッジ時間 1,495 ms
ジャッジサーバーID
(参考情報)
judge6 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sample = "abcdefghijklm"

def main():
    S = input()
    if is_include_invalid_char(S):
        print("Impossible")
        sys.exit()

    if len(set(S)) == 13:
        for s in list(sample):
            print(s)
    elif len(set(S)) == 12:
        for x, y in zip(list(sample), sorted(list(set(S)))):
            if not x == y:
                print(x)
                sys.exit()
        print(sample[-1])
    else:
        print("Impossible")

def is_include_invalid_char(values):
    for s in list(values):
        if not s in sample:
            return True
    return False

if __name__ == '__main__':
    main()
0