結果

問題 No.893 お客様を誘導せよ
ユーザー tactac
提出日時 2019-09-27 21:27:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 1,380 bytes
コンパイル時間 1,607 ms
コンパイル使用メモリ 174,244 KB
実行使用メモリ 4,540 KB
最終ジャッジ日時 2023-10-25 01:43:31
合計ジャッジ時間 2,482 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n;
    cin >> n;
    queue<int> a[n];
    rep(i, n) {
        int k;
        cin >> k;
        rep(j, k) {
            int A;
            cin >> A;
            a[i].push(A);
        }
    }
    vector<int> ans;
    while (1) {
        int cnt = 0;
        rep(i, n) {
            if (sz(a[i]) == 0) {
                cnt++;
                continue;
            }
            ans.eb(a[i].front());
            a[i].pop();
        }
        if (cnt == n) break;
    }
    rep(i, sz(ans)) cout << ans[i] << " "; cout << endl;
}
0