結果

問題 No.893 お客様を誘導せよ
ユーザー SSRSSSRS
提出日時 2020-08-29 07:08:58
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 596 bytes
コンパイル時間 690 ms
コンパイル使用メモリ 81,824 KB
実行使用メモリ 4,472 KB
最終ジャッジ日時 2023-08-08 23:56:45
合計ジャッジ時間 1,532 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 6 ms
4,380 KB
testcase_03 AC 17 ms
4,376 KB
testcase_04 AC 18 ms
4,380 KB
testcase_05 AC 16 ms
4,376 KB
testcase_06 AC 12 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 35 ms
4,472 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<queue<int>> Q(N);
	for (int i = 0; i < N; i++){
		int P;
		cin >> P;
		for (int j = 0; j < P; j++){
			int A;
			cin >> A;
			Q[i].push(A);
		}
	}
	vector<int> ans;
	while (1){
		bool upd = false;
		for (int i = 0; i < N; i++){
			if (!Q[i].empty()){
				ans.push_back(Q[i].front());
				Q[i].pop();
				upd = true;
			}
		}
		if (!upd){
			break;
		}
	}
	int T = ans.size();
	for (int i = 0; i < T; i++){
		cout << ans[i];
		if (i < T - 1){
			cout << ' ';
		}
	}
	cout << endl;
}
0