結果

問題 No.1618 Convolution?
ユーザー だれだれ
提出日時 2021-07-10 14:09:17
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 102 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 1,318 ms
コンパイル使用メモリ 28,512 KB
実行使用メモリ 8,076 KB
最終ジャッジ日時 2023-09-24 15:06:34
合計ジャッジ時間 6,989 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,988 KB
testcase_01 AC 0 ms
5,060 KB
testcase_02 AC 64 ms
6,636 KB
testcase_03 AC 75 ms
7,548 KB
testcase_04 AC 64 ms
5,804 KB
testcase_05 AC 6 ms
5,064 KB
testcase_06 AC 84 ms
7,000 KB
testcase_07 AC 83 ms
7,032 KB
testcase_08 AC 65 ms
5,872 KB
testcase_09 AC 100 ms
7,956 KB
testcase_10 AC 69 ms
5,988 KB
testcase_11 AC 95 ms
7,636 KB
testcase_12 AC 102 ms
7,956 KB
testcase_13 AC 99 ms
8,028 KB
testcase_14 AC 99 ms
8,076 KB
testcase_15 AC 99 ms
8,024 KB
testcase_16 AC 100 ms
8,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

long long n;
long long a[200010], b[200010];
long long c[400010];

int main(){
    scanf("%lld", &n);
    for (int i = 0; i < n; i++){
        scanf("%lld", a + i);
    }
    for (int i = 0; i < n; i++){
        scanf("%lld", b + i);
    }
    long long sum = a[0] + b[0];
    for (int i = 1; i < 2 * n; i++){
        c[i] += c[i - 1] + sum;
        if (i < n) sum += a[i] + b[i];
        else{
            sum -= a[i - n] + b[i - n];
            if (i + 1 < 2 * n) c[i + 1] -= (a[i - n] + b[i - n]) * n;
        }
    }
    for (int i = 0; i < 2 * n; i++){
        printf("%lld", c[i]);
        printf((i == 2 * n - 1? "\n": " "));
    }
}
0