結果

問題 No.893 お客様を誘導せよ
コンテスト
ユーザー arudo
提出日時 2026-05-25 19:47:12
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 865 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,627 ms
コンパイル使用メモリ 340,348 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-05-25 19:47:16
合計ジャッジ時間 4,062 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
純コード判定待ち
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h> 

using i64 = long long; 
using u64 = unsigned long long; 
using u32 = unsigned; 

using u128 = unsigned __int128; 
using i128 = __int128; 

void solve() {
	int N;
	std::cin >> N;

	std::vector<std::queue<int>> A(N);

	std::queue<int> ans;

	int max = -1;

	for(int i = 0; i < N; i ++) {
		int p;
		std::cin >> p;

		max = std::max(max, p);

		while(p -- ) {
			int a;
			std::cin >> a;

			A[i].push(a);
		}
	}

	for(int i = 0; i < max; i ++) {
		for(int j = 0; j < N; j ++) {
			if(!A[j].empty()) {
				int a = A[j].front();
				A[j].pop();
				ans.push(a);
			}
		}
	}

	while(!ans.empty()) {
		int a = ans.front();
		ans.pop();

		std::cout << a << " ";
	}

	std::cout << "\n";
} 

int main() { 
	std::ios::sync_with_stdio(false); 
	std::cin.tie(nullptr); 

	int T = 1; 
	//std::cin >> T; 

	while (T--) { 
		solve(); 
	} 
	return 0; 
}
0