結果

問題 No.50 おもちゃ箱
ユーザー むらため
提出日時 2019-02-05 10:37:03
言語 Nim
(2.2.0)
結果
WA  
実行時間 -
コード長 489 bytes
コンパイル時間 3,390 ms
コンパイル使用メモリ 66,104 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 11:24:30
合計ジャッジ時間 4,594 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 3
other AC * 5 WA * 33
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

diff #

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