結果

問題 No.205 マージして辞書順最小
ユーザー snrnsidy
提出日時 2021-06-08 10:49:28
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 3,573 ms
コンパイル使用メモリ 202,320 KB
最終ジャッジ日時 2025-01-22 04:53:56
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	string res,s;
	int n;
	priority_queue <string,vector<string>,greater<string>> pque;

	cin >> n;

	for (int i = 0; i < n; i++)
	{
		cin >> s;
		s += '\xff';
		pque.push(s);
	}

	while (!pque.empty())
	{
		string now = pque.top();
		pque.pop();

		res += now[0];
		if (now.substr(1).length() > 0)
		{
			pque.push(now.substr(1));
		}
	}

	cout << res << '\n';

	return 0;
}
0