結果
問題 | No.762 PDCAパス |
ユーザー |
|
提出日時 | 2019-01-17 12:03:20 |
言語 | Nim (2.2.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,085 bytes |
コンパイル時間 | 960 ms |
コンパイル使用メモリ | 74,264 KB |
最終ジャッジ日時 | 2024-11-14 20:46:14 |
合計ジャッジ時間 | 1,977 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(2, 28) Error: cannot open file: queues
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformatimport sets,tables,intsets,queues,heapqueue,bitopstemplate get*():string = stdin.readLine().strip()macro unpack*(arr: auto,cnt: static[int]): auto =let t = genSym(); result = quote do:(let `t` = `arr`;())for i in 0..<cnt: result[1].add(quote do:`t`[`i`])template times*(n:int,body) = (for _ in 0..<n: body)proc toCountSeq[T](x:seq[T]) : seq[tuple[k:T,v:int]] = toSeq(x.toCountTable().pairs)template `max=`*(x,y) = x = max(x,y)template `min=`*(x,y) = x = min(x,y)let (n,m) = get().split().map(parseInt).unpack(2)let S = toSeq(get().items).mapIt:case it:of 'P':0of 'D':1of 'C':2else : 3let UV = newSeqWith(m,get().split().map(parseInt)).mapIt((u:it[0]-1,v:it[1]-1))var DC = newSeq[(int,int)]()var CA = newSeq[int]()var ans = newSeq[int](n)for uv in UV:var (u,v) = uvif S[u] > S[v]: (u,v) = (v,u)if S[v] - S[u] != 1 : continuecase S[v]:of 1 : ans[v] += 1of 2 : DC &= (u,v)else : CA &= ufor dc in DC: ans[dc[1]] += ans[dc[0]]echo CA.mapIt(ans[it]).sum() mod 1000000007