結果

問題 No.893 お客様を誘導せよ
ユーザー chocoruskchocorusk
提出日時 2019-09-28 10:04:53
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 947 bytes
コンパイル時間 943 ms
コンパイル使用メモリ 106,944 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-09 02:59:35
合計ジャッジ時間 1,730 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	queue<int> que[1001];
	for(int i=0; i<n; i++){
		int p; cin>>p;
		for(int j=0; j<p; j++){
			int a; cin>>a;
			que[i].push(a);
		}
	}
	vector<int> ans;
	while(1){
		bool ok=1;
		for(int i=0; i<n; i++){
			if(!que[i].empty()){
				ans.push_back(que[i].front());
				que[i].pop();
				ok=0;
			}
		}
		if(ok) break;
	}
	int m=ans.size();
	for(int i=0; i<m; i++){
		cout<<ans[i];
		if(i<m-1) cout<<" ";
	}
	cout<<endl;
	return 0;
}
0