結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
alpha_virginis
|
| 提出日時 | 2015-05-08 23:38:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 821 bytes |
| コンパイル時間 | 1,444 ms |
| コンパイル使用メモリ | 166,620 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 20:42:09 |
| 合計ジャッジ時間 | 1,898 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 7 WA * 8 |
ソースコード
#include <bits/stdc++.h>
int main() {
std::string str[64];
int N;
int times = 0;
std::vector<char> v;
std::cin >> N;
for(int i = 0; i < N; ++i) {
std::cin >> str[i];
times += str[i].size();
}
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();
if( str[0].empty() ) {
for(int j = 1; j < N; ++j) {
str[j-1] = str[j];
}
str[N-1] = "";
}
for(int j = 1; j < N; ++j) {
if( str[j-1] > str[j] && not str[j].empty() ) {
std::swap(str[j-1], str[j]);
}
else {
break;
}
}
}
v.push_back('\0');
std::cout << &v[0] << std::endl;
return 0;
}
alpha_virginis