結果
| 問題 |
No.587 七対子
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-03-16 21:58:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 866 bytes |
| コンパイル時間 | 963 ms |
| コンパイル使用メモリ | 111,376 KB |
| 最終ジャッジ日時 | 2025-01-19 17:38:40 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
string s;
cin >> s;
vector<int32_t> hist(26);
for (auto c : s) {
++hist[c - 'a'];
}
vector<int32_t> ns(2);
for (auto i = 0; i < 26; ++i) {
if (hist[i] == 1 || hist[i] == 2)
++ns[hist[i] - 1];
}
int32_t ans = -1;
if (ns[0] == 1 && ns[1] == 6) {
for (auto i = 0; i < 26; ++i) {
if (hist[i] == 1)
ans = i;
}
}
if (ans != -1) {
cout << char('a' + ans) << endl;
} else {
cout << "Impossible" << endl;
}
return 0;
}