結果

問題 No.1618 Convolution?
ユーザー hiikunZhiikunZ
提出日時 2021-07-22 22:11:26
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 1,056 bytes
コンパイル時間 4,004 ms
コンパイル使用メモリ 200,600 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2023-09-24 17:15:18
合計ジャッジ時間 8,304 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 81 ms
10,096 KB
testcase_03 AC 97 ms
11,732 KB
testcase_04 AC 105 ms
8,908 KB
testcase_05 AC 10 ms
4,380 KB
testcase_06 AC 135 ms
10,608 KB
testcase_07 AC 134 ms
10,852 KB
testcase_08 AC 105 ms
9,168 KB
testcase_09 AC 161 ms
12,272 KB
testcase_10 AC 108 ms
9,372 KB
testcase_11 AC 151 ms
11,688 KB
testcase_12 AC 169 ms
12,488 KB
testcase_13 AC 168 ms
12,412 KB
testcase_14 AC 167 ms
12,492 KB
testcase_15 AC 168 ms
12,404 KB
testcase_16 AC 167 ms
12,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
const ll MAX = 5000000000000000000;
const ld PI = 3.14159265358979;
const ll MOD = 0;//2024948111;
ld dotorad(ld K){return PI * K / 180.0;}
ld radtodo(ld K){return K * 180.0 / PI;}
mt19937 mt;
void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());}
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N),B(N);
    for(ll i = 0;i < N;i++) cin >> A[i];
    for(ll j = 0;j < N;j++) cin >> B[j];
    for(ll j = 0;j < N;j++) A[j] = A[j] + B[j];
    vector<ll> C(N * 2),D(N * 2);
    C[1] = A[0];
    ll s = 0;
    for(ll i = 0;i < N;i++) s += A[i];
    for(ll i = 1;i < N;i++){
        C[i + 1] = C[i] * 2 - C[i - 1] + A[i];
    }
    for(ll i = N;i < N * 2 - 1;i++){
        C[i + 1] = C[i] + s;
    }
    ll p = 0;
    for(ll i = N;i < N * 2 - 1;i++){
        p += A[i - N] * N;
        D[i + 1] = p + C[i - N + 1];
    }
    for(ll i = 0;i < N * 2 - 1;i++){
        cout << C[i] - D[i] << " ";
    }
    cout << C[N * 2 - 1] - D[N * 2 - 1] << endl;
}
0