結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2015-05-08 23:14:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 779 bytes |
| コンパイル時間 | 673 ms |
| コンパイル使用メモリ | 88,248 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-05 20:17:34 |
| 合計ジャッジ時間 | 1,256 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())
int main(){
int n;
cin>>n;
priority_queue<string,vector<string>,greater<string> > pq;
rep(i,n){
string s;
cin>>s;
s+='~';
pq.push(s);
}
string ans;
while(!pq.empty()){
string s=pq.top();pq.pop();
if(s=="~")continue;
ans+=s[0];
s.erase(s.begin());
pq.push(s);
}
cout<<ans<<endl;
return 0;
}
hirokazu1020