結果
| 問題 | No.8116 TCP ソート | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2025-04-03 12:04:46 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 779 bytes | 
| コンパイル時間 | 1,179 ms | 
| コンパイル使用メモリ | 85,388 KB | 
| 実行使用メモリ | 7,716 KB | 
| 最終ジャッジ日時 | 2025-04-03 12:04:51 | 
| 合計ジャッジ時間 | 3,381 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 11 WA * 1 RE * 15 | 
ソースコード
#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]];
	if (count_of['C'] == 0)
	{
		for (; count_of['P'] != 0; --count_of['P'], ++i)
			S[i] = 'P';
		for (i = 0; count_of['T'] != 0; --count_of['T'], ++i)
			S[i] = 'T';
	}
	else
	{
		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;
}
            
            
            
        