結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
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 -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 8) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated]
/home/judge/data/code/Main.nim(3, 8) Warning: Deprecated since v1.5; Use auto instead.; any is deprecated [Deprecated]

ソースコード

diff #

import sequtils,strutils
proc L:any=stdin.readLine.parseInt
proc R:any=stdin.readLine.split.map(parseInt)
var
 w=L()
 n=L()
 J=R()
 m=L()
 C=R()
 s=n+m
 t=n+m+1
 x=n+m+2
 F=newSeqWith(x,newSeq[tuple[t,p,r:int]]())
 U:seq[int]
 ans=0
proc a(s,t,p:int)=
 F[s]&=(t,p,F[t].len)
 F[t]&=(s,0,F[s].len-1)
for i,j in J:a s,i,j
for i,c in C:a n+i,t,c
for c in n..<n+m:
 let X=R()[1..^1].mapit:it-1
 for j in toSeq(0..<n).filterIt(it notin X):a j,c,99999
proc dfs(s,t,f:int):int=
 if s==t:return f
 U[s]=1
 for i,e in F[s]:
  if U[e.t]==1 or e.p<=0:continue
  let d=dfs(e.t,t,f.min(e.p))
  if d>0:(F[s][i].p-=d;F[e.t][e.r].p+=d;return d)
while true:
 U=newSeq[int]x
 let f=dfs(s,t,99999)
 if f==0:
  if w>ans:quit "BANSAKUTSUKITA",0
  else:quit "SHIROBAKO",0
 ans+=f
0