結果

問題 No.548 国士無双
ユーザー dnishdnish
提出日時 2017-07-28 22:43:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 704 bytes
コンパイル時間 1,590 ms
コンパイル使用メモリ 174,808 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 15:48:46
合計ジャッジ時間 2,443 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#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;
}
0