結果

問題 No.548 国士無双
ユーザー tamtam484tamtam484
提出日時 2017-07-28 22:50:11
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,850 bytes
コンパイル時間 791 ms
コンパイル使用メモリ 105,548 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 15:49:00
合計ジャッジ時間 1,480 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 1 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 AC 1 ms
4,348 KB
testcase_23 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <sstream> //string stream its useful!
#include<string>
#include<iostream>
#include<utility> //pair
#include <vector> // vector
#include <algorithm>    // swap,sort,binary_search
#include <functional>   // std::greater
#include <map> //map
#include<set> //set
#include<queue> //queue
#include<list> //list
#include<cmath>
#include<numeric>
#include<cassert>
#include <iomanip> //cout<<setprecision
#include <regex>
#include <ctype.h> //toupper case
#include <tuple>

typedef long long ll;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
ll W = 1000000007;


using namespace std;
void omajinai() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(15);
}

class Main{
public:
    string s;
    int x[13];
    Main(){
        cin>>s;
    }
    void run(){
        fill(x,x+13,0);
        REP(i,s.size()){
            const int tt = s.at(i) - 'a';
            if(tt>=13){
                cout<<"Impossible"<<endl;
                return;
            }
            x[tt]++;
        }
        const int zerocount = count_if(x,x+13,[](int x){return x == 0;});
        const int onecount = count_if(x,x+13,[](int x){return x == 1;});
        const int twocount = count_if(x,x+13,[](int x){return x == 2;});
        
        if(zerocount == 1 && onecount == 11 && twocount == 1){
            REP(i,13){ if(x[i]  == 0){
                cout<<(char)( 'a' + i) <<endl;
                return;
            }
            }
        }
        
        
        if ( zerocount == 0 && onecount == 13 && twocount == 0){
            REP(i,13) cout<<(char)( 'a' +i) <<endl;
            return;
        }
        cout<<"Impossible"<<endl;
    }
};

#ifndef gtest
int main(){
    omajinai();
    Main().run();
    return 0;
}
#endif
0