結果

問題 No.893 お客様を誘導せよ
ユーザー kunitaka4649kunitaka4649
提出日時 2019-09-28 00:39:23
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,482 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 76,576 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 08:34:33
合計ジャッジ時間 2,974 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
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 RE -
testcase_09 RE -
testcase_10 AC 2 ms
4,348 KB
testcase_11 RE -
testcase_12 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <list>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (1ll<<32);
static const int MAX = 101;

int main(int argc, const char * argv[]) {
    // input from txt
    /////////
    //write//
    /////////
    
    int n;
    queue<int> q[MAX];
    cin >> n;
    rep(i, n){
        int p;
        cin >> p;
        rep(j, p){
            int a;
            cin >> a;
            q[i].push(a);
        }
    }
    
    bool ok = true;
    queue<int> res;
    while(ok){
        ok = false;
        rep(i, n)
        {
            if(!q[i].empty())
            {
                int f = q[i].front();
                q[i].pop();
                res.push(f);
                ok = true;
                
            }
        }
    }
    
    int v = res.size();
    rep(i,v){
        if(i)cout << " ";
        cout << res.front();
        res.pop();
    }
    
    cout << endl;
    
    
    return 0;
}
0