結果

問題 No.50 おもちゃ箱
ユーザー むらため
提出日時 2019-02-07 04:07:23
言語 Nim
(2.2.0)
結果
AC  
実行時間 490 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 3,470 ms
コンパイル使用メモリ 66,556 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-01 11:26:17
合計ジャッジ時間 6,741 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 38
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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 q():any=stdin.readLine
proc R():any=q().split.map(parseInt).sorted cmp
var
 n=q().parseInt
 A=R()
 m=q().parseInt+1
 B=R().reversed
 a=m
while true:(var(T,i,j)=(B,0,0);while i<n and j<m-1:(if T[j]>=A[i]:(T[j]-=A[i];i+=1)else:j+=1);a=a.min j+1;if not A.nextPermutation:break)
echo if a<m: a else: -1
0