結果

問題 No.999 てん vs. ほむ
ユーザー tsushimatsushima
提出日時 2020-02-29 08:53:47
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 900 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 43,264 KB
最終ジャッジ日時 2024-04-21 21:27:41
合計ジャッジ時間 3,962 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
18,688 KB
testcase_01 AC 28 ms
19,072 KB
testcase_02 AC 29 ms
19,200 KB
testcase_03 AC 30 ms
19,072 KB
testcase_04 AC 30 ms
18,944 KB
testcase_05 AC 33 ms
19,456 KB
testcase_06 AC 30 ms
19,200 KB
testcase_07 AC 33 ms
19,456 KB
testcase_08 AC 36 ms
20,352 KB
testcase_09 AC 125 ms
41,984 KB
testcase_10 AC 58 ms
25,088 KB
testcase_11 AC 50 ms
23,552 KB
testcase_12 AC 70 ms
29,312 KB
testcase_13 AC 135 ms
43,008 KB
testcase_14 AC 134 ms
43,008 KB
testcase_15 AC 135 ms
43,008 KB
testcase_16 AC 136 ms
43,264 KB
testcase_17 AC 104 ms
38,912 KB
testcase_18 AC 103 ms
38,912 KB
testcase_19 AC 102 ms
39,168 KB
testcase_20 AC 104 ms
39,040 KB
testcase_21 AC 134 ms
42,880 KB
testcase_22 AC 133 ms
42,112 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {
        var sol = new Solve();
        sol.Exec();
    }
}

class Solve
{
    public void Exec()
    {
        var N = int.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var acumFoward = new List<long>() { 0 };
        var acumBack = new List<long>() { 0 };
        for (var i = 1; i < 2 * N; i+=2)
        {
            acumFoward.Add(acumFoward[acumFoward.Count - 1] + A[i - 1] - A[i]);
            acumBack.Add(acumBack[acumBack.Count - 1] + A[A.Length - 1 - i + 1] - A[A.Length - 1 - i]);
        }

        var ans = 0L;
        for (var i = 0; i <= N; i++)
        {
            ans = Math.Max(ans, acumFoward[i] + acumBack[N - i]);
        }

        Console.WriteLine(ans);
    }
}

public class Util
{
}
0