結果

問題 No.1965 Heavier
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-08 23:01:30
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 257 ms / 2,000 ms
コード長 788 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 66,172 KB
実行使用メモリ 61,316 KB
最終ジャッジ日時 2023-10-08 23:01:40
合計ジャッジ時間 9,407 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
19,680 KB
testcase_01 AC 60 ms
19,684 KB
testcase_02 AC 61 ms
23,900 KB
testcase_03 AC 60 ms
21,904 KB
testcase_04 AC 60 ms
19,848 KB
testcase_05 AC 61 ms
21,964 KB
testcase_06 AC 242 ms
53,816 KB
testcase_07 AC 233 ms
53,752 KB
testcase_08 AC 226 ms
55,712 KB
testcase_09 AC 236 ms
56,596 KB
testcase_10 AC 237 ms
54,520 KB
testcase_11 AC 243 ms
54,676 KB
testcase_12 AC 62 ms
21,800 KB
testcase_13 AC 61 ms
21,868 KB
testcase_14 AC 60 ms
21,828 KB
testcase_15 AC 232 ms
51,696 KB
testcase_16 AC 234 ms
51,824 KB
testcase_17 AC 182 ms
46,124 KB
testcase_18 AC 239 ms
55,456 KB
testcase_19 AC 234 ms
52,936 KB
testcase_20 AC 237 ms
53,404 KB
testcase_21 AC 223 ms
53,468 KB
testcase_22 AC 222 ms
52,784 KB
testcase_23 AC 175 ms
42,672 KB
testcase_24 AC 201 ms
48,988 KB
testcase_25 AC 235 ms
53,112 KB
testcase_26 AC 227 ms
54,140 KB
testcase_27 AC 257 ms
59,172 KB
testcase_28 AC 250 ms
61,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    static long[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var b = NList;
        var dp = new int[n];
        var ans = 0L;
        for (var i = 1; i < n; ++i)
        {
            if (a[i] - b[i] > a[i - 1] - b[i - 1] && a[i] + b[i] > a[i - 1] + b[i - 1]) dp[i] = dp[i - 1] + 1;
            ans += dp[i];
        }
        WriteLine(ans);
    }
}
0