結果

問題 No.548 国士無双
ユーザー kekenx
提出日時 2020-03-22 14:55:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 527 bytes
コンパイル時間 2,020 ms
コンパイル使用メモリ 175,360 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-24 17:36:05
合計ジャッジ時間 2,930 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  string s;
  cin >> s;
  map<int, int> m;
  int n = s.size();
  for (int i = 0; i < n; ++i) {
    m[s[i] - 'a']++;
  }

  if (m.size() < 12) {
    puts("Impossible");
  } else if (m.size() == 13) {
    for (int i = 0; i < 13; ++i) {
      char ans = i + 'a';
      cout << ans << '\n';
    }
  } else {
    for (int i = 0; i < 13; ++i) {
      if (m[i] == 0) {
	char ans = i + 'a';
	cout << ans << '\n';
	break;
      }
    }
  }
  return 0;
}
0