結果

問題 No.548 国士無双
ユーザー kyo1
提出日時 2020-07-21 20:54:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 2,394 ms
コンパイル使用メモリ 200,332 KB
最終ジャッジ日時 2025-01-12 01:32:51
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

const string chars = "abcdefghijklm";

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string S;
  cin >> S;
  map<char, int> mp;
  int cnt = 0;
  for (char s : S) {
    mp[s]++;
    if (mp[s] > 1) cnt++;
  }
  if (cnt >= 2) {
    cout << "Impossible" << '\n';
    return 0;
  }
  for (char s : chars) {
    if (mp[s] == 0 && cnt == 1) {
      cout << s << '\n';
    }
    if (mp[s] == 1 && cnt == 0) {
      cout << s << '\n';
    }
  }
  return 0;
}
0