結果

問題 No.4 おもりと天秤
ユーザー AreTrashAreTrash
提出日時 2016-04-12 16:17:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 520 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 106,572 KB
実行使用メモリ 40,568 KB
最終ジャッジ日時 2023-09-08 16:38:16
合計ジャッジ時間 5,154 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,676 KB
testcase_01 AC 63 ms
21,668 KB
testcase_02 AC 64 ms
21,768 KB
testcase_03 AC 63 ms
21,676 KB
testcase_04 AC 64 ms
21,568 KB
testcase_05 AC 93 ms
36,376 KB
testcase_06 AC 64 ms
21,640 KB
testcase_07 AC 97 ms
39,668 KB
testcase_08 AC 65 ms
21,672 KB
testcase_09 AC 64 ms
19,748 KB
testcase_10 AC 103 ms
40,568 KB
testcase_11 AC 65 ms
23,852 KB
testcase_12 AC 64 ms
21,856 KB
testcase_13 AC 63 ms
21,808 KB
testcase_14 AC 64 ms
19,700 KB
testcase_15 AC 63 ms
21,792 KB
testcase_16 AC 63 ms
21,768 KB
testcase_17 AC 64 ms
21,672 KB
testcase_18 AC 80 ms
28,828 KB
testcase_19 AC 93 ms
36,796 KB
testcase_20 AC 95 ms
34,816 KB
testcase_21 AC 93 ms
32,288 KB
testcase_22 AC 92 ms
32,916 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.Collections.Generic;
using System.Linq;

namespace No4_4{
    public class Program{
        public static void Main(string[] args){
            Console.ReadLine();
            var ws = Console.ReadLine().Split().ToList().ConvertAll(int.Parse);
            var dp = new List<int>{0};

            dp = ws.Aggregate(dp, (l, w) => l.Union(l.Select(i => i + w)).ToList());
            Console.WriteLine(ws.Sum() % 2 == 0 && dp.Contains(ws.Sum() / 2) ? "possible" : "impossible");
        }
    }
}
0