結果

問題 No.4 おもりと天秤
ユーザー AreTrashAreTrash
提出日時 2016-04-12 15:17:57
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 84 ms / 5,000 ms
コード長 535 bytes
コンパイル時間 2,160 ms
コンパイル使用メモリ 108,524 KB
実行使用メモリ 29,084 KB
最終ジャッジ日時 2023-09-08 16:37:56
合計ジャッジ時間 4,792 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,668 KB
testcase_01 AC 64 ms
22,892 KB
testcase_02 AC 65 ms
20,668 KB
testcase_03 AC 66 ms
24,728 KB
testcase_04 AC 65 ms
20,736 KB
testcase_05 AC 82 ms
24,480 KB
testcase_06 AC 66 ms
24,712 KB
testcase_07 AC 82 ms
24,996 KB
testcase_08 AC 65 ms
22,844 KB
testcase_09 AC 64 ms
22,752 KB
testcase_10 AC 84 ms
29,084 KB
testcase_11 AC 66 ms
24,864 KB
testcase_12 AC 66 ms
24,724 KB
testcase_13 AC 65 ms
24,824 KB
testcase_14 AC 66 ms
24,732 KB
testcase_15 AC 65 ms
22,812 KB
testcase_16 AC 65 ms
22,696 KB
testcase_17 AC 65 ms
22,680 KB
testcase_18 AC 73 ms
24,888 KB
testcase_19 AC 80 ms
26,220 KB
testcase_20 AC 80 ms
24,512 KB
testcase_21 AC 80 ms
26,176 KB
testcase_22 AC 80 ms
24,344 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_3{
    public class Program{
        public static void Main(string[] args){
            Console.ReadLine();
            var ws = Console.ReadLine().Split().ToList().ConvertAll(int.Parse);
            var dp = new HashSet<int>{0};

            foreach(var w in ws)
                dp.UnionWith(dp.Select(i => i + w).ToArray());

            Console.WriteLine(ws.Sum() % 2 == 0 && dp.Contains(ws.Sum() / 2) ? "possible" : "impossible");
        }
    }
}
0