結果
問題 | No.548 国士無双 |
ユーザー |
|
提出日時 | 2017-07-28 22:50:11 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,850 bytes |
コンパイル時間 | 984 ms |
コンパイル使用メモリ | 103,004 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-17 13:29:24 |
合計ジャッジ時間 | 1,630 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#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