結果
| 問題 | No.205 マージして辞書順最小 |
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-08-16 21:47:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 528 bytes |
| コンパイル時間 | 830 ms |
| コンパイル使用メモリ | 69,136 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 18:23:24 |
| 合計ジャッジ時間 | 1,622 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 7 WA * 8 |
ソースコード
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
int n; cin >> n;
vector<string> s(n);
rep(i, n) cin >> s[i];
string t;
int sum = 0;
rep(i, n){
sum += s[i].size();
}
sort(s.begin(), s.end());
rep(i, sum){
rep(j, n){
if(!s[j].empty()){
t += s[j][0];
s[j].erase(s[j].begin());
break;
}
}
sort(s.begin(), s.end());
}
cout << t << endl;
return 0;
}
srup٩(๑`н´๑)۶