結果

問題 No.548 国士無双
ユーザー pekempey
提出日時 2017-07-28 22:29:44
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 726 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 71,844 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 20:22:14
合計ジャッジ時間 1,336 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

int main() {
    std::string s;
    std::cin >> s;

    std::vector<int> cnt(26);
    bool two = false;
    bool other = false;
    for (char c : s) {
        if (++cnt[c - 'a'] >= 2) {
            two = true;
        }
        if (c > 'm') {
            other = true;
        }
    }

    if (other) {
        puts("IMPOSSIBLE");
        return 0;
    }

    if (two) {
        for (int i = 0; i < 13; i++) {
            if (cnt[i] == 0) {
                std::cout << (char)(i + 'a') << std::endl;
            }
        }
    } else {
        for (int i = 0; i < 13; i++) {
            std::cout << (char)(i + 'a') << std::endl;
        }
    }
}
0