結果
問題 |
No.548 国士無双
|
ユーザー |
|
提出日時 | 2020-04-09 16:42:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 733 bytes |
コンパイル時間 | 776 ms |
コンパイル使用メモリ | 72,416 KB |
最終ジャッジ日時 | 2025-01-09 15:28:58 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <iostream> #include <vector> #include <string> void solve() { std::vector<int> cnt(13, 0); { std::string s; std::cin >> s; for (char c : s) { ++cnt[c - 'a']; } } bool pos = false; for (int c = 0; c < 13; ++c) { ++cnt[c]; int two = 0; for (auto x : cnt) { if (x > 2) two = 2; if (x == 2) ++two; } if (two == 1) { std::cout << char('a' + c) << std::endl; pos = true; } --cnt[c]; } if (!pos) std::cout << "Impossible" << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }