結果

問題 No.545 ママの大事な二人の子供
ユーザー NoNo
提出日時 2018-01-28 00:52:56
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,096 bytes
コンパイル時間 2,336 ms
コンパイル使用メモリ 104,832 KB
実行使用メモリ 819,836 KB
最終ジャッジ日時 2023-08-28 10:12:08
合計ジャッジ時間 10,969 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,912 KB
testcase_01 AC 62 ms
21,856 KB
testcase_02 AC 62 ms
23,700 KB
testcase_03 AC 62 ms
21,676 KB
testcase_04 AC 62 ms
21,732 KB
testcase_05 AC 62 ms
23,860 KB
testcase_06 AC 62 ms
23,896 KB
testcase_07 AC 62 ms
23,696 KB
testcase_08 AC 62 ms
21,784 KB
testcase_09 AC 62 ms
19,644 KB
testcase_10 AC 62 ms
23,796 KB
testcase_11 AC 62 ms
21,688 KB
testcase_12 AC 63 ms
21,844 KB
testcase_13 AC 62 ms
21,704 KB
testcase_14 AC 64 ms
21,872 KB
testcase_15 AC 63 ms
23,752 KB
testcase_16 AC 65 ms
22,456 KB
testcase_17 AC 74 ms
27,484 KB
testcase_18 AC 216 ms
66,676 KB
testcase_19 AC 655 ms
181,124 KB
testcase_20 TLE -
testcase_21 AC 66 ms
21,632 KB
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 s = new int[n];

            int a = 0;
            int[] k1 = new int[n];
            int[] k2 = new int[n];
            for (int i = 0; i < n; i++)
            {
                var u = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
                k1[i] = u[0];
                k2[i] = u[1];
                a += u[0];
            }


            var li1 = new List<int>();
            li1.Add(a);
            for (int i = 0; i < s.Length; i++)
            {
                int e = li1.Count;
                var li2 = new List<int>();
                for (int j = 0; j < e; j++)
                {
                    li2.Add(li1[j]);
                    li2.Add(li1[j] - (k1[i] + k2[i]));
                }
                li1 = li2;
            }

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