結果

問題 No.893 お客様を誘導せよ
ユーザー furafura
提出日時 2020-04-13 14:02:58
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 207,108 KB
実行使用メモリ 4,616 KB
最終ジャッジ日時 2023-10-25 01:08:56
合計ジャッジ時間 3,005 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,428 KB
testcase_01 AC 2 ms
4,428 KB
testcase_02 AC 5 ms
4,540 KB
testcase_03 AC 13 ms
4,552 KB
testcase_04 AC 13 ms
4,552 KB
testcase_05 AC 12 ms
4,552 KB
testcase_06 AC 9 ms
4,556 KB
testcase_07 AC 2 ms
4,428 KB
testcase_08 AC 24 ms
4,616 KB
testcase_09 AC 2 ms
4,436 KB
testcase_10 AC 2 ms
4,428 KB
testcase_11 AC 3 ms
4,428 KB
testcase_12 AC 3 ms
4,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,m=0; scanf("%d",&n);
	queue<int> Q[1000];
	rep(i,n){
		int p; scanf("%d",&p);
		rep(j,p){
			int a; scanf("%d",&a);
			Q[i].push(a);
		}
		m+=p;
	}

	vector<int> ans;
	while(ans.size()<m){
		rep(i,n) if(!Q[i].empty()) ans.emplace_back(Q[i].front()), Q[i].pop();
	}
	rep(i,m) printf("%d%c",ans[i],i<m-1?' ':'\n');

	return 0;
}
0