結果

問題 No.1618 Convolution?
ユーザー 👑 kakel-sankakel-san
提出日時 2021-07-22 22:04:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 367 ms / 2,000 ms
コード長 792 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 67,740 KB
実行使用メモリ 76,472 KB
最終ジャッジ日時 2023-09-24 17:04:50
合計ジャッジ時間 10,431 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
15,564 KB
testcase_01 AC 59 ms
15,564 KB
testcase_02 AC 247 ms
46,424 KB
testcase_03 AC 279 ms
53,844 KB
testcase_04 AC 254 ms
50,032 KB
testcase_05 AC 81 ms
19,036 KB
testcase_06 AC 316 ms
56,260 KB
testcase_07 AC 315 ms
56,208 KB
testcase_08 AC 260 ms
49,520 KB
testcase_09 AC 367 ms
64,732 KB
testcase_10 AC 269 ms
52,412 KB
testcase_11 AC 346 ms
67,120 KB
testcase_12 AC 362 ms
76,472 KB
testcase_13 AC 362 ms
72,336 KB
testcase_14 AC 361 ms
74,248 KB
testcase_15 AC 365 ms
72,412 KB
testcase_16 AC 359 ms
74,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class yuki1
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var n = NN;
        var a = NList;
        var b = NList;

        var ab = new long[n];
        for (var i = 0; i < n; ++i) ab[i] = a[i] + b[i];
        var cum = new long[n];
        cum[0] = ab[0];
        for (var i = 1; i < n; ++i) cum[i] = cum[i - 1] + ab[i];
        var c = new long[2 * n];
        for (var i = 1; i <= n; ++i) c[i] = c[i - 1] + cum[i - 1];
        for (var i = n + 1; i < 2 * n; ++i) c[i] = c[i - 1] - n * ab[i - n - 1] + cum[n - 1] - cum[i - n - 1];

        WriteLine(string.Join(" ", c));
    }
}
0