結果

問題 No.8116 TCP ソート
ユーザー 2qbingxuan
提出日時 2025-04-01 23:53:22
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,016 bytes
コンパイル時間 3,603 ms
コンパイル使用メモリ 280,304 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-04-01 23:53:27
合計ジャッジ時間 4,502 ms
ジャッジサーバーID
(参考情報)
judge4 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define all(x) begin(x), end(x)
#ifdef CKISEKI
#include <experimental/iterator>
#define safe cerr<<__PRETTY_FUNCTION__<<" line "<<__LINE__<<" safe\n"
#define debug(a...) debug_(#a, a)
#define orange(a...) orange_(#a, a)
void debug_(auto s, auto ...a) {
  cerr << "\e[1;32m(" << s << ") = (";
  int f = 0;
  (..., (cerr << (f++ ? ", " : "") << a));
  cerr << ")\e[0m\n";
}
void orange_(auto s, auto L, auto R) {
  cerr << "\e[1;33m[ " << s << " ] = [ ";
  using namespace experimental;
  copy(L, R, make_ostream_joiner(cerr, ", "));
  cerr << " ]\e[0m\n";
}
#else
#define safe ((void)0)
#define debug(...) safe
#define orange(...) safe
#endif

signed main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  string S;
  cin >> S;
  if (S.find('C') == string::npos) {
    sort(all(S));
  } else {
    int rk[256] = {};
    rk['T'] = 0;
    rk['C'] = 1;
    rk['P'] = 2;
    sort(all(S), [rk](char a, char b) {
      return rk[a] < rk[b];
    });
  }
  cout << S << '\n';
}
0