結果

問題 No.548 国士無双
ユーザー forest3
提出日時 2020-04-07 17:07:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 561 bytes
コンパイル時間 1,763 ms
コンパイル使用メモリ 175,340 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-07 17:40:29
合計ジャッジ時間 3,100 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
	string S;
	cin >> S;

	map<char, int> mp;
	for( int i = 0; i < S.size(); i++ ) {
		mp[ S[i] ]++;
	}

	int cnt1 = 0;
	int cnt2 = 0;
	for( auto e : mp ) {
		if( e.second == 1 ) cnt1++;
		if( e.second == 2 ) cnt2++;
	}

	if( cnt1 == 13 ) {
		for( int i = 0; i < S.size(); i++ ) cout << (char)('a' + i) << endl;
	}
	else if( cnt1 == 11 && cnt2 == 1 ) {
		for( int i = 0; i < S.size(); i++ ) if( mp.count( (char)('a' + i) ) == 0 ) cout << (char)('a' + i) << endl;
	}
	else cout << "Impossible" << endl;
}
0