結果

問題 No.548 国士無双
ユーザー pekempey
提出日時 2017-07-28 23:16:40
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 726 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 71,680 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 20:25:14
合計ジャッジ時間 1,470 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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