結果

問題 No.205 マージして辞書順最小
ユーザー btkbtk
提出日時 2015-05-08 23:10:29
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,814 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 90,372 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-19 08:08:50
合計ジャッジ時間 2,214 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
4,384 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 WA -
testcase_18 AC 2 ms
4,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<fstream>
#include<sstream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<list>
#include<algorithm>
#include<utility>
#include<complex>
#include<functional>
using namespace std;

#define reE(i,a,b) for(auto (i)=(a);(i)<=(b);(i)++)
#define rE(i,b) reE(i,0,b)
#define reT(i,a,b) for(auto (i)=(a);(i)<(b);(i)++)
#define rT(i,b) reT(i,0,b)
#define rep(i,a,b) reE(i,a,b);
#define rev(i,a,b) for(auto (i)=(b)-1;(i)>=(a);(i)--)
#define fe(i,b) for (auto &(x):b);
#define itr(i,b) for(auto (i)=(b).begin();(i)!=(b).end();++(i))
#define rti(i,b) for(auto (i)=(b).rbegin();(i)!=(b).rend();++(i))
#define LL long long
#define all(b) (b).begin(),(b).end()

#define input_init stringstream ss; string strtoken, token; istringstream is
#define input_line  getline(cin, strtoken);is.str(strtoken);is.clear(istringstream::goodbit)
#define input_token(num) ss.str(""); ss.clear(stringstream::goodbit); getline(is, token, ','); ss << token; ss >> num

#define dir(xx,yy,x,y,i) (xx)=(x)+dir[(i)],(yy)=(y)+dir[(i)+1]

typedef pair<char, int> P;
int main(void){
	int N;

	cin >> N;


	//priority_queue<P, vector<P>, greater<P>> que;
	
	vector<list<char> > str(N);
	
	/*
	vector<bool> used(N, false);
	*/
	string s;
	for (int i = 0; i < N; i++){
		cin >> s;
		for (auto& var : s){
			str[i].push_back(var);
		}
	}

	s = "";
	while(str[0].size()>0){
		s += str[0].front(); str[0].pop_front();
	}
	for (auto& var : str){
		string t = "";
		int i = 0;
		while (var.size()>0 || i < (int)s.size()){
			if (var.size() == 0 || (i<(int)s.size()&&var.front() > s[i]))
				t += s[i++];
			else {
				t += var.front();
				var.pop_front();
			}
		}
		s = t;

	}
	cout <<s<< endl;

	return(0);
}
0