結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-29 03:06:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 503 bytes |
| コンパイル時間 | 2,328 ms |
| コンパイル使用メモリ | 203,388 KB |
| 最終ジャッジ日時 | 2025-01-12 07:27:16 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
priority_queue<string, vector<string>, greater<string> > Q;
string ret;
int n;
cin >> n;
REP (i, n) {
string s;
cin >> s;
Q.push(s + "|");
}
while (!Q.empty()) {
string x = Q.top();
Q.pop();
ret += x[0];
x = x.substr(1);
if (x != "|")
Q.push(x);
}
cout << ret << endl;
return 0;
}