結果

問題 No.893 お客様を誘導せよ
ユーザー nemakura3nemakura3
提出日時 2019-09-27 21:38:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 668 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 171,520 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-24 09:43:58
合計ジャッジ時間 2,846 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,a,b) for (int (i)=(a);(i)<(b);++(i))
#define sz(x) (x).size()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF = 1e9;
const ll LINF = 1LL<<60;
const ll MOD = 1e9+7;

int N;
queue<int> A[1000];

int main() {
  cin>>N;
  int sum = 0;
  rep(i,0,N) {
    int P; cin >>P;
    sum += P;
    rep(j,0,P) {
      int a; cin>>a;
      A[i].push(a);
    }
  }
  while (sum > 0) {
    rep(i,0,N) {
      if (!A[i].empty()) {
        int a = A[i].front(); A[i].pop();
        if (sum > 1) cout << a << ' ';
        else cout << a;
        --sum;
      }
    }
  }
  return 0;
}
0