結果

問題 No.587 七対子
ユーザー pekempey
提出日時 2017-11-03 22:30:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 71,512 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-22 15:55:38
合計ジャッジ時間 1,569 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

using namespace std;

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

  vector<int> cnt(256);
  for (char c : s) {
    cnt[c]++;
  }

  char ans;
  int uniq = 0;
  for (int i = 0; i < 256; i++) {
    if (cnt[i] == 1) {
      ans = i;
    } else if (cnt[i] > 2) {
      cout << "Impossible" << endl;
      return 0;
    }
    if (cnt[i] <= 2) {
      uniq++;
    }
  }
  if (uniq != 7) {
    cout << "Impossible" << endl;
    return 0;
  }

  cout << ans << endl;
}
0