結果

問題 No.999 てん vs. ほむ
ユーザー 抹茶アイス
提出日時 2023-08-25 13:23:28
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 838 bytes
コンパイル時間 1,223 ms
コンパイル使用メモリ 106,752 KB
実行使用メモリ 60,032 KB
最終ジャッジ日時 2024-12-23 21:22:08
合計ジャッジ時間 45,807 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 < 2 * 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