結果

問題 No.893 お客様を誘導せよ
ユーザー face4face4
提出日時 2019-09-27 21:25:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 612 bytes
コンパイル時間 2,171 ms
コンパイル使用メモリ 76,320 KB
実行使用メモリ 4,808 KB
最終ジャッジ日時 2023-10-25 01:37:41
合計ジャッジ時間 2,980 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 39 ms
4,696 KB
testcase_09 AC 3 ms
4,392 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<queue>
using namespace std;

int main(){
    int n;
    cin >> n;
    queue<int> q[n];
    for(int i = 0; i < n; i++){
        int p;  cin >> p;
        while(p-- > 0){
            int x;  cin >> x;
            q[i].push(x);
        }
    }
    queue<int> j;
    for(int i = 0; i < n; i++)  j.push(i);
    vector<int> v;
    while(!j.empty()){
        int x = j.front();  j.pop();
        v.push_back(q[x].front());  q[x].pop();
        if(!q[x].empty())   j.push(x);
    }
    for(int i = 0; i < v.size(); i++)   cout << v[i] << " \n"[i+1==v.size()];
    return 0;
}
0