結果

問題 No.545 ママの大事な二人の子供
ユーザー No
提出日時 2018-01-27 22:36:52
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
実行時間 -
コード長 852 bytes
コンパイル時間 1,010 ms
コンパイル使用メモリ 114,460 KB
実行使用メモリ 707,776 KB
最終ジャッジ日時 2024-12-29 07:07:04
合計ジャッジ時間 20,035 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 RE * 6 TLE * 5 MLE * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

namespace y
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var li1 = new List<int[]>();
            li1.Add(new int[] { 0, 0 });

            for (int i = 0; i < n; i++)
            {
                var li2 = new List<int[]>();
                var num = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                foreach (var item in li1)
                {
                    li2.Add(new int[] { item[0] + num[0], item[1] });
                    li2.Add(new int[] { item[0], item[1] + num[1] });
                }
                li1 = li2;
            }

            var ans = li1.Min(x => Math.Abs( x[0] - x[1]));
            Console.WriteLine(ans);
        }
    }
}
0