結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-08 22:45:55 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 342 bytes |
| コンパイル時間 | 566 ms |
| コンパイル使用メモリ | 69,084 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 19:05:10 |
| 合計ジャッジ時間 | 1,162 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <string>
#include <queue>
using namespace std;
int main(){
priority_queue<string,vector<string>,greater<string> >q;
int N;
for(cin>>N;N--;){
string s;
cin>>s;
q.push(s+'~');
}
string t;
for(;!q.empty();){
string s=q.top();q.pop();
t+=s[0];
if(s.size()>2)q.push(s.substr(1));
}
cout<<t<<endl;
}