結果
問題 |
No.205 マージして辞書順最小
|
ユーザー |
![]() |
提出日時 | 2015-05-08 23:25:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 827 bytes |
コンパイル時間 | 517 ms |
コンパイル使用メモリ | 63,832 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 20:38:28 |
合計ジャッジ時間 | 2,646 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 5 WA * 1 RE * 9 |
ソースコード
// Wrongri-La Shower #include <iostream> #include <algorithm> std::string S[50]; int main(){ int N; std::cin >> N; int L = 0; for(int i=0;i<N;i++){ std::cin >> S[i]; L += S[i].size(); } std::string T = ""; std::string *first = S; for(int i=0;i<L;i++){ std::sort(first, first+N, [](const std::string& lhs, const std::string& rhs){ int l = std::min(lhs.size(), rhs.size()); for(int i=0;i<l;i++){ if(lhs[i] != rhs[i]){ return lhs[i] < rhs[i]; } } return true; }); T += (*first)[0]; first->erase(0, 1); if(first->size() == 0){ ++first; --N; } } std::cout << T << std::endl; }