結果

問題 No.999 てん vs. ほむ
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-08-25 13:09:53
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 3,548 ms
コンパイル使用メモリ 108,348 KB
実行使用メモリ 48,216 KB
最終ジャッジ日時 2023-08-25 13:10:03
合計ジャッジ時間 8,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
21,864 KB
testcase_01 AC 60 ms
21,872 KB
testcase_02 AC 61 ms
21,760 KB
testcase_03 AC 61 ms
19,888 KB
testcase_04 AC 63 ms
21,756 KB
testcase_05 WA -
testcase_06 AC 63 ms
21,704 KB
testcase_07 AC 71 ms
24,100 KB
testcase_08 WA -
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace yukicoder
{
    public class Program
    {
        public static void Main()
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split().Select(x => long.Parse(x)).ToList();
            long s = 0;
            for(var i = 0; i <= n; i++)
            {
                var j = 0;
                long t = 0;
                while (j < i)
                {
                    t += a[j] - a[j + 1];
                    j += 2;
                }
                while (j < 2 * n)
                {
                    t += a[j + 1] - a[j];
                    j += 2;
                }
                s = Math.Max(t, s);
            }
            Console.WriteLine(s);
        }
    }
}
0