結果

問題 No.548 国士無双
ユーザー fagfagdfafagfagdfa
提出日時 2017-08-23 18:32:30
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 676 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 6,660 KB
実行使用メモリ 6,024 KB
最終ジャッジ日時 2023-09-19 08:42:03
合計ジャッジ時間 1,605 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
5,956 KB
testcase_01 AC 12 ms
5,952 KB
testcase_02 AC 12 ms
6,008 KB
testcase_03 AC 13 ms
5,816 KB
testcase_04 AC 12 ms
5,820 KB
testcase_05 AC 11 ms
5,860 KB
testcase_06 AC 11 ms
5,868 KB
testcase_07 AC 12 ms
5,816 KB
testcase_08 AC 12 ms
5,888 KB
testcase_09 AC 11 ms
5,956 KB
testcase_10 AC 12 ms
5,960 KB
testcase_11 AC 12 ms
5,940 KB
testcase_12 AC 12 ms
5,808 KB
testcase_13 AC 12 ms
5,816 KB
testcase_14 AC 12 ms
5,956 KB
testcase_15 AC 12 ms
5,960 KB
testcase_16 AC 12 ms
5,884 KB
testcase_17 AC 12 ms
5,856 KB
testcase_18 AC 12 ms
6,012 KB
testcase_19 AC 12 ms
5,804 KB
testcase_20 WA -
testcase_21 AC 12 ms
5,804 KB
testcase_22 AC 12 ms
5,960 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

tmp_s = "abcdefghijklm"
dic = {}

for i in tmp_s:
    dic[i] = 0

s = raw_input()

for i in s:
    if dic[i] == 3 or i not in tmp_s:
        print "Impossible"
        sys.exit()
    else:
        dic[i] += 1

n2 = [0, []]
n1 = [0, []]
n0 = [0, []]

keys = dic.keys()


for i in keys:
    if dic[i] == 2:
        n2[0] += 1
        n2[1].append(i)
    elif dic[i] == 1:
        n1[0] += 1
        n1[1].append(i)
    else:
        n0[0] += 1
        n0[1].append(i)

if n2[0] == 1 and n0[0] == 1:
    print n0[1][0]
elif n0[0] == 1 and n2[0] == 0:
    print n2[1][0]
elif n0[0] == 0 and n2[0] == 0:
    x = sorted(n1[1])
    print x
    for i in x:
        print i
0