# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
986435 | 2024-05-20T14:06:27 Z | Zero_OP | 평균 (COCI14_prosjek) | C++14 | 1 ms | 604 KB |
#include<bits/stdc++.h> using namespace std; using int64 = int64_t; #define FOR(i, l, r) for(int i = (l), _r = (r); i <= _r; ++i) #define FORD(i, r, l) for(int i = (r), _l = (l); i >= _l; --i) #define rep(i, l, r) for(int i = (l), _r = (r); i < _r; ++i) #define repd(i, r, l) for(int i = (r) - 1, _l = l; i >= _l; --i) #define left __left #define right __right #define next __next #define prev __prev #define div __div #define pb push_back #define pf push_front #define all(v) v.begin(), v.end() #define sz(v) (int)v.size() #define compact(v) v.erase(unique(all(v)), end(v)) #define dbg(v) "[" #v " = " << (v) << "]" #define file(name) if(fopen(name".inp", "r")) {freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } template<typename T> bool minimize(T& a, const T& b){ if(a > b) return a = b, true; return false; } template<typename T> bool maximize(T& a, const T& b){ if(a < b) return a = b, true; return false; } template<int dimension, typename T> struct vec : public vector<vec<dimension - 1, T>> { static_assert(dimension > 0, "Dimension must be positive !\n"); template<typename... Args> vec(int n = 0, Args... args) : vector<vec<dimension - 1, T>> (n, vec<dimension - 1, T>(args...)) {} }; template<typename T> struct vec<1, T> : public vector<T> { vec(int n = 0, T val = T()) : vector<T>(n, val) {} }; void preprocess(); void init(); void process(); int main(){ ios_base::sync_with_stdio(0); cin.tie(0); file("antuvu"); preprocess(); int T = 1; //cin >> T; while(T--){ init(); process(); } return 0; } void preprocess(){ } void init(){ } void process(){ int n; cin >> n; vector<int64> b(n + 1), a(n + 1); long long sum = 0; for(int i = 1; i <= n; ++i){ cin >> b[i]; if(i == 1){ a[i] = b[i]; } else{ a[i] = i * b[i] - sum; } sum += a[i]; } for(int i = 1; i <= n; ++i){ cout << a[i] << " \n"[i == n]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 344 KB | Output is correct |
6 | Correct | 0 ms | 604 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
8 | Correct | 1 ms | 348 KB | Output is correct |
9 | Correct | 0 ms | 348 KB | Output is correct |
10 | Correct | 1 ms | 348 KB | Output is correct |