結果

問題 No.1618 Convolution?
ユーザー nebukuro09
提出日時 2021-07-22 21:50:11
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 117,920 KB
実行使用メモリ 34,036 KB
最終ジャッジ日時 2024-06-22 11:54:41
合計ジャッジ時間 7,100 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto B = readln.split.map!(to!long).array;

    long s = 0;
    long t = 0;
    long[] ans;
    foreach (i; 0..N) {
        ans ~= t;
        t += A[i] + B[i] + s;
        s += A[i] + B[i];
    }
    foreach (i; 0..N) {
        ans ~= t;
        t -= N*A[i] + N*B[i];
        s -= A[i] + B[i];
        t += s;
    }


    ans.map!(to!string).join(" ").writeln;
}
0