結果

問題 No.893 お客様を誘導せよ
ユーザー chocopuuchocopuu
提出日時 2019-09-27 21:55:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 924 bytes
コンパイル時間 2,429 ms
コンパイル使用メモリ 171,120 KB
実行使用メモリ 5,404 KB
最終ジャッジ日時 2023-10-24 17:53:53
合計ジャッジ時間 2,359 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 6 ms
4,348 KB
testcase_03 AC 20 ms
4,544 KB
testcase_04 AC 21 ms
4,536 KB
testcase_05 AC 19 ms
4,484 KB
testcase_06 AC 14 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 42 ms
5,404 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (int)(s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
constexpr long long INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}



signed main(){
	int N;
	cin >> N;
	vector<int>v[N];
	REP(i,N){
		int t;
		cin >> t;
		REP(j,t){
			int tt;
			cin >> tt;
			v[i].push_back(tt);
		}
		reverse(ALL(v[i]));
	}
	vector<int>ans;
	int flg = 1;
	while(flg){
		flg = 0;
		REP(i,N){
			if(v[i].size() == 0)continue;
			else{
				flg = 1;
				ans.push_back(v[i].back());
				v[i].pop_back();
			}
		}
	}
	REP(i,ans.size()){
		if(i)cout<<" ";
		cout<<ans[i];
	}
	cout << endl;
}
0