結果

問題 No.548 国士無双
ユーザー Elk
提出日時 2018-06-30 01:37:05
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 992 bytes
コンパイル時間 1,754 ms
コンパイル使用メモリ 178,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-05 20:34:04
合計ジャッジ時間 2,513 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 5 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    map <char, int> mp;
    string str;
    string abc = "abcdefghijklm";
    int cnt = 0, cnt2[13] = {0};
    char daburi = 0;
    int tmp;

    cin >> str;
    sort(str.begin(), str.end());
    for(int i = 0; i < 13; i++){
        cnt2[str[i] - 'a']++;
    }
    for(int i = 0; i < 13; i++){
        if(cnt2[i] == 0){
            tmp = i;
            break;
        }
    }
    
    for(int i = 0; i < str.size(); i++){
        mp[str[i]]++;
    }
    for(auto itr = mp.begin(); itr != mp.end(); itr++){
        if(itr->second != 0){
            cnt++;
        }
        if(itr->second == 2){
            daburi = itr->first;
        }
    }

    if(daburi != 0 && cnt == 12){
        cout << abc[9] << endl;
    }else if(daburi == 0 && cnt == 13){
        for(auto itr = mp.begin(); itr != mp.end(); itr++){
            cout << itr->first << endl;
        }
    }else{
        cout << "Impossible" << endl;
    }

    return 0;
}
0