結果

問題 No.548 国士無双
コンテスト
ユーザー legosuke
提出日時 2017-10-23 01:57:26
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 350µs
コード長 601 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 869 ms
コンパイル使用メモリ 175,540 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-08-29 14:53:22
合計ジャッジ時間 2,497 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

int main(void) {
  string s;
  cin >> s;

  int cnt[26] = {};
  for (int i = 0; i < s.size(); i++) {
    cnt[s[i] - 'a']++;
  }

  int one = 0, two = 0;
  for (int i = 0; i < 13; i++) {
    one += cnt[i] == 1;
    two += cnt[i] == 2;
  }

  if (two == 1 && one == 11) {
    for (int i = 0; i < 13; i++) {
      if (cnt[i]) continue;
      cout << (char)(i + 'a') << endl;
    }
  } else if (two == 0 && one == 13) {
    for (int i = 0; i < 13; i++) {
      cout << (char)(i + 'a') << endl;
    }
  } else {
    cout << "Impossible\n";
  }

  return 0;
}
0