結果
| 問題 | No.587 七対子 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-01 23:26:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 733 bytes |
| 記録 | |
| コンパイル時間 | 1,372 ms |
| コンパイル使用メモリ | 79,592 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 16:17:59 |
| 合計ジャッジ時間 | 2,568 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
// No.587 七対子
// https://yukicoder.me/problems/no/587
//
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
string solve(string &S);
int main() {
cin.tie(0);
string S;
cin >> S;
string ans = solve(S);
cout << ans << endl;
}
string solve(string &S) {
unordered_map<char, int> char_count;
for (char s: S)
char_count[s]++;
string ans = "";
for (auto c: char_count) {
if (c.second > 2) {
ans = "Impossible";
break;
} else if (c.second == 1) {
if (ans != "") {
ans = "Impossible";
break;
}
ans += c.first;
}
}
return ans;
}