結果

問題 No.8116 TCP ソート
ユーザー elphe
提出日時 2025-04-03 11:59:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 945 ms
コンパイル使用メモリ 85,292 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-03 11:59:28
合計ジャッジ時間 1,903 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 11 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdint>
#include <vector>

using namespace std;

static inline const string& solve(string& S) noexcept
{
	vector<uint32_t> count_of(128, 0);
	uint32_t i;
	for (i = 0; i != S.size(); ++i)
		++count_of[S[i]];

	for (i = 0; count_of['T'] != 0; --count_of['T'], ++i)
		S[i] = 'T';
	for (; count_of['C'] != 0; --count_of['C'], ++i)
		S[i] = 'C';
	for (; count_of['P'] != 0; --count_of['P'], ++i)
		S[i] = 'P';

	return S;
}

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	
	string S;
	S.reserve(100), cin >> S;

	cout << solve(S) << '\n';
	return 0;
}
0