結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-03 23:48:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 526 bytes |
| コンパイル時間 | 805 ms |
| コンパイル使用メモリ | 81,776 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 19:44:14 |
| 合計ジャッジ時間 | 1,807 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <map>
using namespace std;
int main() {
string s;
cin >> s;
map<char, int> alpha;
for (char c : s) {
alpha[c]++;
}
string ans = "Impossible";
for (auto x : alpha) {
if (x.second == 1) {
if (ans.size() == 1) {
ans = "Impossible";
break;
} else {
ans = x.first;
}
} else if (x.second > 2) {
ans = "Impossible";
break;
}
}
cout << ans << endl;
return 0;
}