結果

問題 No.548 国士無双
ユーザー troro_kelp
提出日時 2018-06-22 17:45:34
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 983 bytes
コンパイル時間 1,295 ms
コンパイル使用メモリ 159,224 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 20:33:59
合計ジャッジ時間 2,098 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

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

string alphs="abcdefghijklmnopqrstuvwxyz";
int main() {
    string str; cin >> str;
    int alph[26]={0};
    for(int i=0; i<(int)str.size(); ++i){
        for(int j=0; j<26; ++j){
            if(str[i]==alphs[j]){
                alph[j]++;
                if(alph[j]>=2&&j>=13){
                    cout << "Impossible" << endl;
                    return 0;
                }
                break;
            }
        }
    }
    bool flag=true;
    for(int i=0; i<13; ++i){
        if(alph[i]==2) flag = false;
    }
    for(int i=0; i<13; ++i){
        if(!flag&&alph[i]==0){
            cout << "Impossible" << endl;
            return 0;
        }
    }
    if(!flag){
        for(int i=0; i<13; ++i){
            if(alph[i]==0) {
                cout << alphs[i] << endl;
                return 0;
            }
        }
    }else{
        for(int i=0; i<13; ++i)
            cout << alphs[i] << endl;
    }
    return 0;
}
0