結果
問題 |
No.8116 TCP ソート
|
ユーザー |
![]() |
提出日時 | 2025-04-01 22:29:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 476 bytes |
コンパイル時間 | 3,768 ms |
コンパイル使用メモリ | 285,300 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-01 22:29:36 |
合計ジャッジ時間 | 4,613 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int n = (int)s.size(); map<char, int> mp; for (int i = 0; i < n; i++) mp[s[i]]++; auto f = [&](char c) { string res = ""; for (int i = 0; i < mp[c]; i++) res += c; return res; }; string t = f('T'), c = f('C'), p = f('P'); string ans = t + c + p; if (c == "") sort(ans.begin(), ans.end()); cout << ans << endl; return 0; }