結果
問題 | No.205 マージして辞書順最小 |
ユーザー |
|
提出日時 | 2020-07-28 00:34:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 5,000 ms |
コード長 | 357 bytes |
コンパイル時間 | 2,479 ms |
コンパイル使用メモリ | 196,488 KB |
最終ジャッジ日時 | 2025-01-12 07:03:34 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n; cin>>n; int m=0; vector<string> s(n); rep(i,n){ cin>>s[i]; m+=s[i].length(); s[i]+='z'+1; } string ans; rep(_,m){ int i=min_element(s.begin(),s.end())-s.begin(); ans+=s[i][0]; s[i].erase(0,1); } cout<<ans<<'\n'; return 0; }