結果

問題 No.548 国士無双
ユーザー Noiri
提出日時 2019-01-26 23:19:09
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 167,348 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-17 14:53:42
合計ジャッジ時間 2,080 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int a[999];

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