結果

問題 No.548 国士無双
コンテスト
ユーザー pekempey
提出日時 2017-07-28 22:29:44
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 726 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 448 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-27 05:51:14
合計ジャッジ時間 1,095 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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