結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2015-05-09 00:09:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 746 bytes |
| コンパイル時間 | 1,545 ms |
| コンパイル使用メモリ | 168,664 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 20:51:21 |
| 合計ジャッジ時間 | 2,279 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
int main() {
std::string str[64];
int N;
int times = 0;
std::vector<char> v;
std::string t;
std::cin >> N;
for(int i = 0; i < N; ++i) {
std::cin >> t;
t += "{";
str[i] = t;
times += str[i].size()-1;
}
std::sort(str, str+N);
for(int i = 0; i < times; ++i) {
v.push_back(str[0][0]);
for(int j = 1; j < str[0].size(); ++j) {
str[0][j-1] = str[0][j];
}
str[0][str[0].size()-1] = '\0';
str[0] = str[0].c_str();
for(int j = 1; j < N; ++j) {
if( str[j-1] > str[j] && str[j].size() != 1 ) {
std::swap(str[j-1], str[j]);
}
else {
break;
}
}
}
v.push_back('\0');
std::cout << &v[0] << std::endl;
return 0;
}
alpha_virginis