結果

問題 No.548 国士無双
ユーザー xsdxsd
提出日時 2020-06-20 12:06:28
言語 OCaml
(5.1.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 09:00:38
合計ジャッジ時間 1,071 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Scanf.scanf "%s" (fun s ->
    let a = Array.make 13 0 in
    String.iter (fun c ->
        let q = int_of_char c - 97 in
        a.(q) <- a.(q) + 1) s;
    let a = Array.mapi (fun i v -> v, i) a in
    Array.sort compare a;
    if fst a.(12) > 2 || fst a.(11) > 1 then print_endline "Impossible" else
    if fst a.(0) = 1 then (
        String.iter (fun c -> Printf.printf "%c\n" c) "abcdefghijklm"
    ) else
        Printf.printf "%c\n" "abcdefghijklm".[snd a.(0)]
)
0