結果

問題 No.50 おもちゃ箱
ユーザー むらためむらため
提出日時 2019-02-05 10:32:58
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 503 bytes
コンパイル時間 3,161 ms
コンパイル使用メモリ 72,216 KB
実行使用メモリ 4,568 KB
最終ジャッジ日時 2023-09-14 03:31:13
合計ジャッジ時間 4,940 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 4 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 3 ms
4,376 KB
testcase_22 AC 8 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 20 ms
4,380 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 14 ms
4,380 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 10) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated]
/home/judge/data/code/Main.nim(3, 10) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated]
/home/judge/data/code/Main.nim(1, 26) Warning: imported and not used: 'algorithm' [UnusedImport]

ソースコード

diff #

import sequtils,strutils,algorithm
proc r():any=stdin.readLine.parseInt
proc R():any=stdin.readLine.split.map(parseInt)
var
 N=r()
 K=1 shl N
 A=R()
 M=r()
 B=R()
 S=newSeq[int]K
for n in 0..<K:
 for ia in 0..<N:
  if(n and(1 shl ia))==(1 shl ia):S[n] += A[ia]
var ans=S.mapIt(B[0]-it>=0)
if ans[K-1]:quit "1",0
for i,b in B[1..^1]:
 var n_ans = S.mapIt(false)
 for x,a in ans:
  if a:
   for y,s in S:
    if (x and y)==0 and b-s>=0:n_ans[x xor y]=true
 ans = n_ans
 if ans[K-1] : quit $(i+2),0
echo -1
0