結果
問題 | No.893 お客様を誘導せよ |
ユーザー | ponponpainful |
提出日時 | 2019-09-27 21:33:03 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 1,389 bytes |
コンパイル時間 | 1,548 ms |
コンパイル使用メモリ | 175,460 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 20:52:03 |
合計ジャッジ時間 | 2,320 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#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; }