結果

問題 No.8116 TCP ソート
ユーザー GOTKAKO
提出日時 2025-04-01 21:33:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 207,672 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-04-01 21:33:48
合計ジャッジ時間 3,020 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    string s; cin >> s;
    map<char,int> M = {
        {'T',0},
        {'C',1},
        {'P',2}
    };
    bool apc = false;
    for(auto c : s){
        if(c == 'C') apc = true;
    }
    if(apc){
        sort(s.begin(),s.end(),[&](auto &a,auto &b){
            return M[a] < M[b];
        });
    }
    else sort(s.begin(),s.end());
    cout << s << endl;
}
0