結果

問題 No.1618 Convolution?
ユーザー milanis48663220milanis48663220
提出日時 2021-07-22 22:21:43
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 1,269 bytes
コンパイル時間 1,132 ms
コンパイル使用メモリ 118,536 KB
実行使用メモリ 9,464 KB
最終ジャッジ日時 2023-09-24 17:30:57
合計ジャッジ時間 5,991 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 45 ms
7,992 KB
testcase_03 AC 53 ms
8,768 KB
testcase_04 AC 48 ms
6,928 KB
testcase_05 AC 5 ms
4,380 KB
testcase_06 AC 63 ms
7,968 KB
testcase_07 AC 63 ms
8,192 KB
testcase_08 AC 49 ms
6,996 KB
testcase_09 AC 75 ms
9,464 KB
testcase_10 AC 52 ms
7,248 KB
testcase_11 AC 72 ms
8,836 KB
testcase_12 AC 75 ms
9,276 KB
testcase_13 AC 75 ms
9,324 KB
testcase_14 AC 74 ms
9,324 KB
testcase_15 AC 76 ms
9,400 KB
testcase_16 AC 76 ms
9,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <cmath>
#include <numeric>
#include <functional>
#include <cassert>

#define debug_value(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << #x << "=" << x << endl;
#define debug(x) cerr << "line" << __LINE__ << ":<" << __func__ << ">:" << x << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using namespace std;
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int n; cin >> n;
    vector<ll> a(n), b(n), c(2*n+1);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++){
        c[i+1] += a[i]+b[i];
        c[i+n+1] -= a[i]+b[i];
        // break;
    }
    for(int i = 1; i < 2*n; i++) c[i] += c[i-1];
    for(int i = 0; i < n; i++){
        c[i+n+1] -= (a[i]+b[i])*(n);
        // break;
    }
    for(int i = 1; i < 2*n; i++) c[i] += c[i-1];
    for(int i = 0; i < 2*n; i++) cout << c[i] << ' ';
    cout << endl;
}
0