結果

問題 No.4 おもりと天秤
ユーザー 6soukiti296soukiti29
提出日時 2017-07-05 19:33:38
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 384 bytes
コンパイル時間 3,154 ms
コンパイル使用メモリ 68,780 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-12 13:15:21
合計ジャッジ時間 4,402 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 3 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 3 ms
4,376 KB
testcase_10 AC 3 ms
4,376 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 3 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils,math

var
    N = stdin.readline.parseInt
    W : seq[int]
W = stdin.readline.split.map(parseInt)
var A = newSeqWith(sum(W) div 2 + 2,false)
A[0] = true
for w in W:
    for i in countdown(sum(W) div 2 + 1,w):
        if A[i - w] == true:
            A[i] = true
if sum(W) mod 2 == 0 and A[sum(W) div 2] == true:
    echo "possible"
else:
    echo "imposible"
0