結果

問題 No.893 お客様を誘導せよ
ユーザー ooooobaoooooba
提出日時 2021-05-08 20:49:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 1,139 ms
コンパイル使用メモリ 122,156 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 06:25:40
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t n;
    cin >> n;
    vector<vector<int32_t>> amat(n);
    int32_t m = 0;
    for (auto i = 0; i < n; ++i) {
        int32_t p;
        cin >> p;
        for (auto j = 0; j < p; ++j) {
            int32_t a;
            cin >> a;
            amat[i].push_back(a);
            ++m;
        }
        reverse(amat[i].begin(), amat[i].end());
    }
    while (m > 0) {
        for (auto i = 0; i < n; ++i) {
            if (amat[i].empty())
                continue;
            cout << amat[i].back() << (m == 1 ? '\n' : ' ');
            amat[i].pop_back();
            --m;
        }
    }
    return 0;
}
0