結果

問題 No.893 お客様を誘導せよ
ユーザー hatsuka_iwahatsuka_iwa
提出日時 2021-01-27 05:14:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 1,724 ms
コンパイル使用メモリ 172,284 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-06 08:17:06
合計ジャッジ時間 3,413 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<queue<int>> A(N);
  bool check = true;
  int max_queue = 0, max_size = INT_MIN;
  
  for (int i = 0; i < N; i++) {
    int P;
    cin >> P;
    for (int j = 0; j < P; j++) {
      int a;
      cin >> a;
      A.at(i).push(a);
    }
    if ((int)A.at(i).size() >= max_size) {
      max_queue = i;
      max_size = A.at(i).size();
    }
  }
  
  while (check) {
    check = false;
    for (int i = 0; i < N; i++) {
      if (!A.at(i).empty()) {
        check = true;
        cout << A.at(i).front();
        A.at(i).pop();
        if(!A.at(max_queue).empty())
          cout << ' ';
      }
    }
  }
  cout << endl;
}
0