結果

問題 No.970 数列変換マシン
ユーザー LayCurseLayCurse
提出日時 2020-01-19 05:30:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 8 ms / 2,000 ms
コード長 2,005 bytes
コンパイル時間 2,347 ms
コンパイル使用メモリ 209,656 KB
実行使用メモリ 5,176 KB
最終ジャッジ日時 2023-09-15 19:45:37
合計ジャッジ時間 4,712 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
5,064 KB
testcase_01 AC 8 ms
4,968 KB
testcase_02 AC 8 ms
4,920 KB
testcase_03 AC 5 ms
4,960 KB
testcase_04 AC 5 ms
4,924 KB
testcase_05 AC 5 ms
4,924 KB
testcase_06 AC 4 ms
5,040 KB
testcase_07 AC 5 ms
5,176 KB
testcase_08 AC 6 ms
4,908 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
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 rd(long long &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(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');
  }
}
int N;
long long Y[100000];
long long res[100000];
int main(){
  int i;
  long long s;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(Y[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    long long cTE1_r3A;
    if(N==0){
      cTE1_r3A = 0;
    }
    else{
      cTE1_r3A = Y[0];
      for(e98WHCEY=(1);e98WHCEY<(N);e98WHCEY++){
        cTE1_r3A += Y[e98WHCEY];
      }
    }
    s =cTE1_r3A;
  }
  for(i=(0);i<(N);i++){
    res[i] = s - Y[i] * (N-1);
  }
  {
    int t_ynMSdg;
    if(N==0){
      putchar_unlocked('\n');
    }
    else{
      for(t_ynMSdg=(0);t_ynMSdg<(N-1);t_ynMSdg++){
        wt_L(res[t_ynMSdg]);
        wt_L(' ');
      }
      wt_L(res[t_ynMSdg]);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// int N; ll Y[1d5];
// ll res[1d5];
// {
//   ll s;
//   rd(N,Y(N));
//   s = sum(Y(N));
//   rep(i,N) res[i] = s - Y[i] * (N-1);
//   wt(res(N));
// }
0