結果
問題 | No.4 おもりと天秤 |
ユーザー | Himatsubushin |
提出日時 | 2019-12-21 11:56:29 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,112 bytes |
コンパイル時間 | 1,297 ms |
コンパイル使用メモリ | 64,016 KB |
実行使用メモリ | 26,232 KB |
最終ジャッジ日時 | 2023-09-26 10:32:51 |
合計ジャッジ時間 | 3,760 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 60 ms
20,008 KB |
testcase_01 | AC | 60 ms
22,248 KB |
testcase_02 | AC | 61 ms
24,216 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 60 ms
22,076 KB |
testcase_07 | WA | - |
testcase_08 | AC | 61 ms
19,952 KB |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 62 ms
24,048 KB |
testcase_12 | AC | 60 ms
22,092 KB |
testcase_13 | AC | 61 ms
21,928 KB |
testcase_14 | AC | 60 ms
22,016 KB |
testcase_15 | AC | 60 ms
20,024 KB |
testcase_16 | WA | - |
testcase_17 | AC | 61 ms
22,024 KB |
testcase_18 | AC | 59 ms
20,128 KB |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
ソースコード
using System; using System.Linq; namespace No004_おもりと天秤 { class Program { static void Main() { int n = int.Parse(Console.ReadLine()); string[] input = Console.ReadLine().Split(' '); int[] list = input.Select(int.Parse).ToArray(); int sum = list.Sum(); int[,] a = new int[3, 6]; bool[,] dp = new bool[101, 10001]; if (sum % 2 == 1) { Console.WriteLine("impossible"); return; } dp[0, 0] = true; for (int i = 0; i < list.Length; i++) { for (int j = 0; j <= 20; j++) { if (dp[i, j] == true) { dp[i + 1, j + list[i]] = true; dp[i + 1, j] = true; } } } if (dp[list.Length, sum / 2] == true) Console.WriteLine("possible"); else Console.WriteLine("impossible"); } } }