結果

問題 No.205 マージして辞書順最小
コンテスト
ユーザー 184
提出日時 2015-05-08 23:41:42
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 513 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 675 ms
コンパイル使用メモリ 94,228 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2026-03-27 06:23:12
合計ジャッジ時間 1,310 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 7 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <queue>
#include <string>
#include <functional>
#include <iostream>


using namespace std;

int main(){
	int n;scanf("%d",&n);
	string t,s;priority_queue<string,vector<string>, greater<string> > p;
	for(int i=0;i<n;i++){cin>>s;p.push(s);}
	while(p.size()){
		 
		char c=p.top()[0];
		t+=c;
		string tmp=p.top();tmp.erase(tmp.begin());p.pop();
		if(tmp.size())p.push(tmp);   
		
	} 
	 
	printf("%s\n",t.c_str());
	
	
	
	return 0;
}
0