結果
| 問題 |
No.205 マージして辞書順最小
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-02-07 03:50:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 648 bytes |
| コンパイル時間 | 968 ms |
| コンパイル使用メモリ | 103,936 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-03 15:33:17 |
| 合計ジャッジ時間 | 1,714 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 15 |
ソースコード
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
string s[55];
int main() {
int n;
cin >> n;
priority_queue<string,vector<string>,greater<string>> q;
for (int i = 0; i < n; i++) {
cin >> s[i];
q.push(s[i] + '{');
}
string ans = "";
while (!q.empty()) {
string s1 = q.top();
q.pop();
if (s1[0] != '{') {
ans += s1[0];
q.push(s1.substr(1, s1.size() - 1));
}
}
cout << ans << endl;
}