結果

問題 No.909 たぴの配置
ユーザー LayCurseLayCurse
提出日時 2019-10-18 21:22:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 3,000 ms
コード長 2,527 bytes
コンパイル時間 2,600 ms
コンパイル使用メモリ 213,036 KB
実行使用メモリ 5,016 KB
最終ジャッジ日時 2023-09-07 21:04:11
合計ジャッジ時間 5,401 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 13 ms
4,824 KB
testcase_06 AC 14 ms
4,948 KB
testcase_07 AC 13 ms
4,968 KB
testcase_08 AC 15 ms
4,856 KB
testcase_09 AC 18 ms
4,872 KB
testcase_10 AC 14 ms
4,820 KB
testcase_11 AC 14 ms
4,748 KB
testcase_12 AC 12 ms
4,820 KB
testcase_13 AC 13 ms
4,884 KB
testcase_14 AC 14 ms
4,932 KB
testcase_15 AC 14 ms
5,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
template<class S, class T> inline S min_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');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  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');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(double x){
  printf("%.15f",x);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    putchar_unlocked(x[i]);
  }
}
template<class S, class T> inline S chmin(S &a, T b){
  if(a>b){
    a=b;
  }
  return a;
}
int N;
int X[200000];
int Y[200000];
int main(){
  int i;
  int res = 1073709056;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
    }
  }
  {
    int KL2GvlyY;
    for(KL2GvlyY=(0);KL2GvlyY<(N);KL2GvlyY++){
      rd(Y[KL2GvlyY]);
    }
  }
  for(i=(0);i<(N);i++){
    chmin(res, X[i] + Y[i]);
  }
  wt_L(res);
  wt_L('\n');
  wt_L(0);
  wt_L('\n');
  for(i=(0);i<(N);i++){
    wt_L(min_L(X[i], res));
    wt_L('\n');
  }
  wt_L(res);
  wt_L('\n');
  return 0;
}
// cLay varsion 20191012-1

// --- original code ---
// int N, X[2d5], Y[2d5];
// {
//   int res = int_inf;
//   rd(N,X(N),Y(N));
//   rep(i,N) res <?= X[i] + Y[i];
//   wt(res);
//   wt(0);
//   rep(i,N) wt(min(X[i],res));
//   wt(res);
// }
0