結果
問題 |
No.177 制作進行の宮森あおいです!
|
ユーザー |
|
提出日時 | 2019-02-05 11:34:07 |
言語 | Nim (2.2.0) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 896 bytes |
コンパイル時間 | 3,619 ms |
コンパイル使用メモリ | 67,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 11:25:13 |
合計ジャッジ時間 | 4,465 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(3, 8) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated] /home/judge/data/code/Main.nim(4, 8) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated]
ソースコード
import sequtils,strutils type E=tuple[dst,cap,rev:int] proc r:any=stdin.readLine.parseInt proc R:any=stdin.readLine.split.map(parseInt) var w=r() n=r() J=R() m=r() C=R() F=newSeqWith(n+m+2,newSeq[E]()) src=n+m dst=n+m+1 proc a(src,dst,cap:int)= F[src]&=(dst,cap,F[dst].len) F[dst]&=(src,0,F[src].len-1) for i,j in J:a src,i,j for i,c in C:a n+i,dst,c for c in n..<n+m: let qx=R() q=qx[0] X=qx[1..^1].mapit:it-1 OK=toSeq(0..<n).filterIt(it notin X) for j in OK:a j,c,1e10.int proc FF():int= var U:seq[bool] proc dfs(src,dst,f:int):int= if src==dst:return f U[src]=true for i,e in F[src]: if U[e.dst] or e.cap<=0:continue let d=dfs(e.dst,dst,f.min(e.cap)) if d>0:(F[src][i].cap-=d;F[e.dst][e.rev].cap+=d;return d) while true: U=newSeq[bool](F.len) let f=dfs(src,dst,1e10.int) if f==0:return result+=f if FF()<w:echo"BANSAKUTSUKITA" else:echo"SHIROBAKO"