結果
問題 | No.893 お客様を誘導せよ |
ユーザー |
|
提出日時 | 2019-09-27 21:33:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 2,068 bytes |
コンパイル時間 | 2,562 ms |
コンパイル使用メモリ | 204,156 KB |
最終ジャッジ日時 | 2025-01-07 19:22:24 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using ld = long double;using vi = vector<int>;using vvi = vector<vi>;using vvvi = vector<vvi>;using vll = vector<ll>;using vvll = vector<vll>;using vvvll = vector<vvll>;using vs = vector<string>;using pll = pair<ll, ll>;using vp = vector<pll>;template<class T> using V = vector<T>;template<class T> using VV = vector<vector<T> >;#define rep(i, n) for(ll i = 0; i < (n); i++)#define repb(i, n) for(ll i = (n)-1; i >= 0; i--)#define repr(i, a, b) for(ll i = (a); i < (b); i++)#define reprb(i, a, b) for(ll i = (a)-1; i >= (b); i--)#define ALL(a) (a).begin(), (a).end()#define SZ(x) ((ll)(x).size())const ll MOD = 1000000007;const ll INF = 100000000000000000LL;inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }inline ll powint(unsigned long long x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }template<class S, class T>inline bool chmax(S &a, const T &b){ if(a<b) { a=b; return 1; } return 0; }template<class S, class T>inline bool chmin(S &a, const T &b){ if(b<a) { a=b; return 1; } return 0; }#ifdef OJ_LOCAL#include "dump.hpp"#else#define dump(...) ((void)0)#endifint main(){cin.tie(0); ios::sync_with_stdio(false);cout << fixed << setprecision(15);ll n;cin >> n;vvll a(n);vll p(n);vll pt(n, 0);vll ans;rep(i, n){cin >> p[i];rep(j, p[i]){ll a_;cin >> a_;a[i].emplace_back(a_);}}queue<ll> x;rep(i, n) x.emplace(i);while(!x.empty()){ll idx = x.front();x.pop();if(pt[idx] < p[idx]){ans.emplace_back(a[idx][pt[idx]]);}if(pt[idx] < p[idx]-1){x.push(idx);pt[idx]++;}}rep(i, SZ(ans)){cout << ans[i] << " \n"[i==SZ(ans)-1];}return 0;}