結果

問題 No.548 国士無双
ユーザー hedwig100
提出日時 2020-05-22 21:18:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 898 bytes
コンパイル時間 1,502 ms
コンパイル使用メモリ 169,888 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-05 14:16:23
合計ジャッジ時間 2,481 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PL;
typedef pair<int,int> P;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main() {
    string S; cin >> S;
    vector<int> alpha(13,0);
    for (char s:S){
        alpha[(int)(s - 'a')] ++;
    }
    vector<int> cnt(3,0);
    bool flag = true;
    for (int p: alpha){
        if (p >= 3){
            flag = false;
            break;
        }
        else{
            cnt[p]++;
        }
    }
    if (!flag){
        printf("Impossible\n");
        return 0;
    }
    if (cnt[2] == 1 && cnt[0] == 1){
        for (int i = 0;i < 13;i++){
            if (alpha[i] == 0){
                cout << (char)(i + 97) << endl;
            }
        }
    }
    else{
        for (int i = 97;i < 97 + 13;i++){
            cout << (char)i << endl;
        }
    }
}
0