結果
問題 |
No.970 数列変換マシン
|
ユーザー |
|
提出日時 | 2020-01-25 15:20:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 18 ms / 2,000 ms |
コード長 | 902 bytes |
コンパイル時間 | 1,550 ms |
コンパイル使用メモリ | 169,532 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 04:05:27 |
合計ジャッジ時間 | 2,935 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; const ll INF=1001001001; const ll LINF=1001001001001001001; #define overload4(_1,_2,_3,_4,name,...) name #define rep1(n) for(ll i=0;i<(n);++i) #define rep2(i,n) for(ll i=0;i<(n);++i) #define rep3(i,a,b) for(ll i=(a);i<(b);++i) #define rep4(i,a,b,c) for(ll i=(a);i<(b);i+=(c)) #define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__) #define all(x) (x).begin(),(x).end() #define vec vector<ll> template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;} template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;} void solve(){ ll n;cin>>n; vec a(n);rep(i,n)cin>>a[i]; ll sum=0; rep(i,n)sum+=a[i]; vec ans(n); rep(i,n)ans[i]=sum-a[i]*(n-1); rep(i,n)cout<<ans[i]<<(i==n-1?'\n':' '); } int main(){ cin.tie(0); ios::sync_with_stdio(0); solve(); }