結果

問題 No.893 お客様を誘導せよ
ユーザー kekenxkekenx
提出日時 2020-01-24 19:21:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 1,462 ms
コンパイル使用メモリ 170,020 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-12 04:15:05
合計ジャッジ時間 3,009 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main() {
  int N;
  scanf("%d", &N);
  vector< queue<int> > A(N);
  int q = 0;
  for (int i = 0; i < N; ++i) {
    int P;
    scanf("%d", &P);
    q += P;
    for (int j = 0; j < P; ++j) {
      int a;
      scanf("%d", &a);
      A[i].push(a);
    }
  }

  while (q > 0) {
    for (int i = 0; i < N; ++i) {
      if (!A[i].empty()) {
	int next = A[i].front(); A[i].pop();
	if (q == 1) cout << next << endl;
	else cout << next << " ";
	q--;
      }
    }
  }
  return 0;
}
0