結果
問題 |
No.205 マージして辞書順最小
|
ユーザー |
![]() |
提出日時 | 2015-08-17 13:03:02 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 6 ms / 5,000 ms |
コード長 | 378 bytes |
コンパイル時間 | 1,526 ms |
コンパイル使用メモリ | 168,052 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 10:00:45 |
合計ジャッジ時間 | 2,336 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<string> s(n); for (auto& i : s) { cin >> i; i += 'z' + 1; } string t; while (!s.empty()) { sort(s.begin(), s.end()); t += s[0][0]; s[0] = s[0].substr(1); if (s[0].size() == 1u) { s[0] = s.back(); s.pop_back(); } } cout << t << endl; }