結果

問題 No.893 お客様を誘導せよ
ユーザー pionepione
提出日時 2019-09-27 22:01:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 1,723 bytes
コンパイル時間 1,453 ms
コンパイル使用メモリ 168,720 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 18:42:54
合計ジャッジ時間 2,182 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 6 ms
4,348 KB
testcase_03 AC 20 ms
4,348 KB
testcase_04 AC 20 ms
4,348 KB
testcase_05 AC 18 ms
4,348 KB
testcase_06 AC 13 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 39 ms
4,348 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 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int a[1005][105];
 
int main(){
  int n;cin>>n;
  int sum=0;
  rep(i,n){
    int p;cin>>p;
    sum+=p;
    rep(j,p){
      cin>>a[i][j];
    }
  }
  
  int cl=0;
  vi pi(n+1,0);
  int cnt=0;
  while(cnt<sum){
    // cout<<cl<<" "<<pi[cl]<<endl;
    if(a[cl][pi[cl]]==0){
      cl++; if(cl>=n)cl=0;
      continue;
    }
    // cout<<cl<<" "<<pi[cl]<<endl;
    cout<<a[cl][pi[cl]];
    if(cnt!=sum) cout<<" ";
    pi[cl]++;
    cl++; if(cl>=n)cl=0;
    cnt++;
  }
  cout<<endl;
}
0