結果

問題 No.587 七対子
ユーザー byami
提出日時 2017-11-18 16:15:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 1,880 ms
コンパイル使用メモリ 173,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 19:47:16
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a;i < n;i++)
using namespace std;

int main() {
    string s; cin >> s;
    map<char, int> mp;
    rep(i, 0, s.size()) {
        mp[s[i]]++;
    }
    int one = 0, two = 0;
    string ans = "Impossible";
    for (auto i : mp) {
        one += i.second == 1;
        two += i.second == 2;
        if (i.second == 1) ans = i.first;
    }
    cout << (one == 1 && two == 6 ? ans : "Impossible") << endl;
}
0