結果
| 問題 | No.205 マージして辞書順最小 |
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-10-17 21:43:20 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 579 bytes |
| 記録 | |
| コンパイル時間 | 1,949 ms |
| コンパイル使用メモリ | 195,952 KB |
| 実行使用メモリ | 7,972 KB |
| 最終ジャッジ日時 | 2026-04-03 03:13:27 |
| 合計ジャッジ時間 | 4,653 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
const string G{ 'z' + 1 };
int n;
cin >> n;
priority_queue<string, vector<string>, greater<string> > pq;
for (int i = 0; i < n; ++i)
{
string s;
cin >> s;
pq.push(s + G);
}
stringstream ss;
while (!pq.empty())
{
string s = pq.top();
ss << s[0];
pq.pop();
if (s.size() > 1 && s.substr(1) != G)
pq.push(s.substr(1));
}
cout << ss.str() << "\n";
return 0;
}
CELICA