結果

問題 No.548 国士無双
ユーザー kyuna
提出日時 2019-07-20 22:10:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 926 ms
コンパイル使用メモリ 72,064 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 17:49:04
合計ジャッジ時間 2,099 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    string s; cin >> s;
    vector<int> cnt(13, 0);
    for (char c: s) cnt[c - 'a']++;
    int one = 0, two = 0;
    for (int ci: cnt) {
        one += ci == 1;
        two += ci == 2;
    }
    if (one == 13) {
        for (int i = 0; i < 13; i++) cout << (char)(i + 'a') << endl;
    } else if (one == 11 && two == 1) {
        for (int i = 0; i < 13; i++) if (cnt[i] == 0) {
            cout << (char)(i + 'a') << endl;
        }
    } else {
        cout << "Impossible" << endl;
    }
    return 0;
}
0