結果

問題 No.893 お客様を誘導せよ
ユーザー LaikaLaika
提出日時 2019-09-27 22:46:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 174,792 KB
実行使用メモリ 4,692 KB
最終ジャッジ日時 2023-10-25 04:38:23
合計ジャッジ時間 2,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(){
    
    int n;
    cin >> n;
    int sum = 0;
    vector<deque<int>> a(n);
    for(int i = 0; i < n; ++i){
        int p;
        cin >> p;
        sum += p;
        for(int j = 0; j < p; ++j){
            int x; scanf("%d", &x);
            a[i].emplace_back(x);    
        }
    }
    int i = 0;
    vector<int> res;
    while(sum){
        if(!a[i].empty()){
            res.emplace_back(a[i].front()); a[i].pop_front();
            --sum;
        }
        ++i;
        if(i >= n) i = 0;
    }
    
    for(int x : res){
        cout << x << " ";
    }
    cout << endl;
    
    return 0;
}
0