結果
問題 | No.970 数列変換マシン |
ユーザー | LayCurse |
提出日時 | 2020-01-17 21:23:06 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 2,005 bytes |
コンパイル時間 | 2,423 ms |
コンパイル使用メモリ | 211,960 KB |
最終ジャッジ日時 | 2025-01-08 18:17:19 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#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 20200112-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)); // }