結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
158b
|
| 提出日時 | 2015-05-09 01:47:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 618 bytes |
| コンパイル時間 | 493 ms |
| コンパイル使用メモリ | 63,320 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 20:57:50 |
| 合計ジャッジ時間 | 1,160 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
using namespace std;
int main(){
int max;
int mind;
int len = 0;
string data[100];
string answer("");
cin >> max;
for(int i=0; i<max; i++){
cin >> data[i];
len += data[i].length();
data[i] += '{';
}
for(int leni=0; leni<len; leni++){
//次に追加すべき番目を求める
mind = 0;
for(int i=1; i<max; i++){
if(data[i] < data[mind]){
mind = i;
}
}
//移動させる
answer += data[mind].substr(0, 1);
data[mind].erase(data[mind].begin());
}
cout << answer << endl;
return 0;
}
158b