#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2")
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
ll n; cin >> n; vector<ll> v(n);
for(ll i = 0; i<n; i++){
cin >> v[i];
}
vector<ll> ans; ans.pb(v[0]);
ll sum=v[0];
for(ll i = 1; i<n; i++){
ans.pb(((i+1)*v[i])-sum); sum+=ans[i];
}
for(ll i = 0; i<n; i++) cout << ans[i] << " ";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
320 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |