結果

問題 No.2284 Assembly
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-27 18:57:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 266 ms / 2,000 ms
コード長 785 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 63,592 KB
実行使用メモリ 36,340 KB
最終ジャッジ日時 2023-09-27 18:57:48
合計ジャッジ時間 6,963 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,592 KB
testcase_01 AC 62 ms
23,556 KB
testcase_02 AC 62 ms
21,460 KB
testcase_03 AC 62 ms
21,624 KB
testcase_04 AC 62 ms
21,596 KB
testcase_05 AC 63 ms
23,524 KB
testcase_06 AC 63 ms
21,464 KB
testcase_07 AC 62 ms
21,480 KB
testcase_08 AC 255 ms
36,216 KB
testcase_09 AC 259 ms
34,188 KB
testcase_10 AC 251 ms
36,340 KB
testcase_11 AC 253 ms
36,256 KB
testcase_12 AC 250 ms
36,272 KB
testcase_13 AC 258 ms
36,296 KB
testcase_14 AC 250 ms
34,416 KB
testcase_15 AC 253 ms
34,228 KB
testcase_16 AC 250 ms
34,180 KB
testcase_17 AC 247 ms
32,280 KB
testcase_18 AC 266 ms
32,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var map = NArr(n);
        var ans = 0L;
        var asum = 0L;
        var bsum = 0L;
        for (var i = n - 2; i >= 0; --i)
        {
            asum += map[i + 1][0];
            bsum += map[i + 1][1];
            ans += Math.Max(map[i][0] * bsum, map[i][1] * asum);
        }
        WriteLine(ans);
    }
}
0