結果

問題 No.893 お客様を誘導せよ
ユーザー Imperi_NightImperi_Night
提出日時 2019-09-27 21:31:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 20 ms / 2,000 ms
コード長 1,575 bytes
コンパイル時間 1,012 ms
コンパイル使用メモリ 107,572 KB
実行使用メモリ 5,280 KB
最終ジャッジ日時 2023-10-25 01:52:45
合計ジャッジ時間 1,782 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 4 ms
4,348 KB
testcase_03 AC 11 ms
4,416 KB
testcase_04 AC 11 ms
4,408 KB
testcase_05 AC 10 ms
4,356 KB
testcase_06 AC 7 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 20 ms
5,280 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << "[" << pa.first << ", " << pa.second << "]";
}

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  os << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "}";
  return os;
}

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  ll n,max=0;
  std::cin>>n;

  std::vector<ll> p(n),now(n),ans;
  std::vector<std::vector<ll>> a(n);

  rep(i,0,n){
    std::cin>>p[i];
    now[i]=p[i];
    max=std::max(max,p[i]);
    rep(j,0,p[i]){
      ll temp;
      std::cin>>temp;
      a[i].push_back(temp);
    }
  }

  rep(_,0,max){
    rep(i,0,n){
    if(now[i]>0){
      ans.push_back(a[i][p[i]-now[i]]);
      now[i]--;
    }
    } 
  }

  rep(i,0,ans.size()){
    std::cout<<ans[i];
    std::cout<<((i!=ans.size()-1)?" ":"\n");
  }

  return 0;
}
0