結果

問題 No.548 国士無双
ユーザー sorag
提出日時 2022-08-01 20:51:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 81,460 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-22 11:43:41
合計ジャッジ時間 1,680 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#define all(x) x.begin(),x.end()
#define pb push_back
#define ll long long
using namespace std;
int main() {
	string n;
	cin >> n;
	vector<char> a;
	string smp= "abcdefghijklm";
	for (char i = 'a'; i <= 'm'; i++) {
		string T = n + i;
		sort(all(T));
		bool cnt = 0;
		for (char d = 'a'; d <= 'z'; d++) {
			string e = smp + d;
			sort(all(e));
			if (T == e) cnt = 1;
		}
		if (cnt) a.pb(i);
	}
	if (a.empty()) cout << "Impossible" << endl;
	else for(int j=0;j<a.size(); j++)  cout << a[j] << endl;
	return 0;
}

0