結果
| 問題 |
No.8116 TCP ソート
|
| コンテスト | |
| ユーザー |
greentea011
|
| 提出日時 | 2025-04-03 15:38:42 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 614 bytes |
| コンパイル時間 | 698 ms |
| コンパイル使用メモリ | 69,792 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-03 15:38:44 |
| 合計ジャッジ時間 | 1,805 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 WA * 16 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
// メイン関数
int main() {
std::string S;
std::cin >> S;
// 文字列をソート
// 条件1: T が C よりも左にある。
// 条件2: C が P よりも左にある。
// => ソートすると自然に辞書順最小になり、条件を満たす
std::sort(S.begin(), S.end(), [](char a, char b) {
// T, C, P の並び順を明確に指定
const std::string order = "TCP";
return order.find(a) < order.find(b);
});
// 結果を出力
std::cout << S << std::endl;
return 0;
}
greentea011