結果

問題 No.587 七対子
ユーザー snrnsidy
提出日時 2025-09-11 23:19:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 597 bytes
コンパイル時間 5,022 ms
コンパイル使用メモリ 210,552 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2025-09-11 23:19:32
合計ジャッジ時間 6,763 ms
ジャッジサーバーID
(参考情報)
judge2 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int cnt[26];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;

    cin >> s;

    for(auto it : s)
    {
        cnt[it-'a'] += 1;
    }

    char res = ' ';

    for(int i=0;i<26;i++)
    {
        if(cnt[i]==0) continue;
        if(cnt[i] > 2)
        {
            cout << "Impossible" << '\n';
            return 0;
        }
        if(res!=' ')
        {
            cout << "Impossible" << '\n';
            return 0;
        }
        res = (char)(i + '0');
    }

    cout << res << '\n';

    return 0;   
}
0