結果

問題 No.893 お客様を誘導せよ
ユーザー ponponpainfulponponpainful
提出日時 2019-09-27 21:33:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 1,389 bytes
コンパイル時間 1,500 ms
コンパイル使用メモリ 174,620 KB
実行使用メモリ 4,620 KB
最終ジャッジ日時 2023-10-25 01:54:51
合計ジャッジ時間 2,288 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 6 ms
4,348 KB
testcase_03 AC 21 ms
4,384 KB
testcase_04 AC 20 ms
4,376 KB
testcase_05 AC 19 ms
4,348 KB
testcase_06 AC 14 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 40 ms
4,620 KB
testcase_09 AC 3 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;
#define REP(i,b,e) for(int i=(b);i<(e);++i)
#define RREP(i,b,e) for(int i=(b)-1;i>=e;--i)
#define rep(i,e) for(int i=0;i<(e);++i)

constexpr int MOD = 1000000007;
constexpr int INF = 1LL << 30;
constexpr long long LLINF = 1LL << 60;

template<typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (T &x : vec) is >> x;
  return is;
}

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "[";
  for (auto it = vec.begin(); it != vec.end(); ++it) {
    if (it != vec.begin()) os << ", ";
    os << *it;
  }
  return os << "]";
}

inline void print(void) { cout<<'\n'; }
template<class T> inline void print(const T &x) { cout<<x<<'\n'; }
template<class T, class... U> inline void print(const T &x, const U&... y) { cout<<x<<" "; print(y...); }

int main() {
  int n; cin>>n;
  vector<deque<int>> a(n);
  vector<int> ans;
  rep(i, n) {
    int p; cin>>p;
    rep(j, p) {
      int t; cin>>t;
      a[i].push_back(t);
    }
  }
  bool flag = true;
  while (flag) {;
    flag = false;
    rep(i, n) {
      if (!a[i].empty()) {
        ans.push_back(a[i].front());
        a[i].pop_front();
        flag = true;
      }
    }
  }
  for (vector<int>::const_iterator it = ans.begin(); it != ans.end(); ++it) {
    cout<<*it;
    if (it != ans.end()-1) cout<<" ";
    else cout<<'\n';
  }
  return 0;
}
0