結果
問題 | No.548 国士無双 |
ユーザー |
![]() |
提出日時 | 2017-07-28 22:43:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 704 bytes |
コンパイル時間 | 1,347 ms |
コンパイル使用メモリ | 174,196 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-17 13:29:11 |
合計ジャッジ時間 | 2,024 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 WA * 1 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n,N) for(int i=(n);i<(int) N;i++) #define RREP(i,n,N) for(int i=N-1;i>=(int) n;i--) #define p(s) cout<<(s)<<endl #define DEBUG(x,y) cout<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define F first #define S second typedef long long ll; using namespace std; const int inf=1e9; map<char,int> m; int main(){ string s; cin>>s; bool flag=true,zero=false; REP(i,0,13){ m[s[i]]++; if(m[s[i]]>1) zero=true; if((m[s[i]]>1&&!CK(s[i],'a','m'+1))||m[s[i]]>2){ flag=false; break; } } if(flag){ for(char c='a';c<='m';c++){ if((m[c]==0)||(!zero&&m[c]==1)){ p(c); } } }else{ p("Impossible"); } return 0; }