結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
kou_kkk
|
| 提出日時 | 2022-10-22 00:13:27 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 5,000 ms |
| コード長 | 339 bytes |
| コンパイル時間 | 4,146 ms |
| コンパイル使用メモリ | 65,408 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 08:10:58 |
| 合計ジャッジ時間 | 4,849 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 |
ソースコード
import sequtils,strutils,math
var
n = parseInt readLine stdin
ws = stdin.readLine.split.map parseInt
x = sum ws
dp = false.repeat 10003
result = "impossible"
dp[0] = true
if x mod 2 == 0:
for i in 0..n - 1:
for j in countdown(10000,0):
if dp[j]: dp[j + ws[i]] = true
if dp[x div 2]: result = "possible"
echo result
kou_kkk