結果

問題 No.548 国士無双
ユーザー kpinkcat
提出日時 2023-08-17 17:19:33
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 790 bytes
コンパイル時間 978 ms
コンパイル使用メモリ 105,300 KB
最終ジャッジ日時 2025-02-16 08:59:18
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<algorithm>
#include<cctype>
#include<set>
#include<bitset>
#include<math.h>
#include<map>
#include<queue>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#include <Windows.h>
#endif

int main()
{
    string s, t = "abcdefghijklm", t2 = "abcdefghijklm";
    cin >> s;
    if (s.size() != 13){
        cout << "Impossible" << endl;
        return 0;
    }
    for (int i = 0; i < 13; i++){
        for (int j = 0; j < t.size(); j++){
            if (s[i] == t[j]){
                t.erase(t.begin()+j);
                break;
            }
        }
    }
    if (t.size() == 1) cout << t << endl;
    else if (t.size() == 0){
        for (char c : t2){
            cout << c << endl;
        }
    }
    else cout << "Impossible" << endl;
}
0