結果

問題 No.177 制作進行の宮森あおいです!
ユーザー むらためむらため
提出日時 2019-02-05 11:34:07
言語 Nim
(2.0.2)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 3,429 ms
コンパイル使用メモリ 72,176 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 03:32:12
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 7 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 15 ms
4,380 KB
testcase_10 AC 24 ms
4,380 KB
testcase_11 AC 20 ms
4,376 KB
testcase_12 AC 12 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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]

ソースコード

diff #

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"
0