結果

問題 No.548 国士無双
ユーザー バカらっくバカらっく
提出日時 2018-03-04 17:20:36
言語 Swift
(5.10.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 580 bytes
コンパイル時間 1,124 ms
コンパイル使用メモリ 102,848 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-08-20 10:28:53
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,804 KB
testcase_01 AC 4 ms
7,808 KB
testcase_02 AC 3 ms
7,860 KB
testcase_03 AC 3 ms
7,988 KB
testcase_04 AC 3 ms
7,860 KB
testcase_05 AC 4 ms
7,864 KB
testcase_06 AC 3 ms
7,880 KB
testcase_07 AC 4 ms
7,820 KB
testcase_08 AC 4 ms
7,988 KB
testcase_09 AC 3 ms
7,880 KB
testcase_10 AC 3 ms
7,720 KB
testcase_11 AC 4 ms
7,720 KB
testcase_12 AC 3 ms
7,732 KB
testcase_13 AC 3 ms
7,808 KB
testcase_14 AC 3 ms
7,736 KB
testcase_15 AC 3 ms
7,620 KB
testcase_16 AC 3 ms
7,860 KB
testcase_17 AC 3 ms
7,720 KB
testcase_18 AC 4 ms
7,724 KB
testcase_19 AC 4 ms
7,724 KB
testcase_20 WA -
testcase_21 AC 3 ms
7,900 KB
testcase_22 AC 3 ms
7,624 KB
testcase_23 AC 3 ms
7,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

let baseChars = "abcdefghijklm".map({$0})

let inpt = readLine()!.map({$0})
let imp = "Impossible"
var isImp = false;
var dic = [Character:Int]()
for c in inpt {
    if(!baseChars.contains(c)) {
        isImp = true
        break
    }
    dic[c] = inpt.filter({$0 == c}).count
    if(dic[c]! > 2) {
        isImp = true
        break
    }
}

if(!isImp) {
    if(dic.count == baseChars.count) {
        for c in baseChars {
            print(c)
        }
    } else {
        let tmp = baseChars.filter({!inpt.contains($0)})[0]
        print(tmp)
    }
} else {
    print(imp)
}
0