結果

問題 No.893 お客様を誘導せよ
ユーザー LayCurseLayCurse
提出日時 2019-09-27 22:05:04
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 1,962 bytes
コンパイル時間 2,523 ms
コンパイル使用メモリ 215,652 KB
実行使用メモリ 4,400 KB
最終ジャッジ日時 2023-10-24 19:40:44
合計ジャッジ時間 3,219 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 4 ms
4,348 KB
testcase_04 AC 4 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 5 ms
4,400 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 #

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S max_L(S a,T b){
  return a>=b?a:b;
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
int N;
int P[1000];
int A[1000][100];
int ress;
int res[100000];
int main(){
  int i, k;
  int mx;
  rd(N);
  for(i=(0);i<(N);i++){
    rd(P[i]);
    {
      int Lj4PdHRW;
      for(Lj4PdHRW=(0);Lj4PdHRW<(P[i]);Lj4PdHRW++){
        rd(A[i][Lj4PdHRW]);
      }
    }
  }
  {
    int KL2GvlyY;
    int Q5VJL1cS;
    if(N==0){
      Q5VJL1cS = 0;
    }
    else{
      Q5VJL1cS = P[0];
      for(KL2GvlyY=(1);KL2GvlyY<(N);KL2GvlyY++){
        Q5VJL1cS = max_L(Q5VJL1cS, P[KL2GvlyY]);
      }
    }
    mx =Q5VJL1cS;
  }
  for(k=(0);k<(mx);k++){
    for(i=(0);i<(N);i++){
      if(k<P[i]){
        res[ress++] = A[i][k];
      }
    }
  }
  {
    int e98WHCEY;
    if(ress==0){
      putchar_unlocked('\n');
    }
    else{
      for(e98WHCEY=(0);e98WHCEY<(ress-1);e98WHCEY++){
        wt_L(res[e98WHCEY]);
        wt_L(' ');
      }
      wt_L(res[e98WHCEY]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190925-1

// --- original code ---
// int N, P[1000], A[1000][100];
// int ress, res[1d5];
// {
//   int mx;
//   rd(N);
//   rep(i,N) rd(P[i], A[i](P[i]));
//   mx = max(P(N));
//   rep(k,mx) rep(i,N) if(k<P[i]) res[ress++] = A[i][k];
//   wt(res(ress));
// }
0