結果
問題 | No.1043 直列大学 |
ユーザー |
|
提出日時 | 2020-05-01 22:38:30 |
言語 | Nim (2.2.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 710 bytes |
コンパイル時間 | 3,414 ms |
コンパイル使用メモリ | 65,792 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 12:01:06 |
合計ジャッジ時間 | 12,146 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 1 |
ソースコード
import strutils, sequtils, math let get = iterator:string = for s in stdin.readAll.split: yield s proc read:int = get().parseInt template mo(a) = a = a mod (10^9+7) let n, m = read() let v = newSeqWith(n, read()) let r = newSeqWith(m, read()) let a, b = read() var vc, rc = 0.repeat(10^5 + 1) vc[0] = 1 for v in v: for i in countdown(10^5 - v, 0): vc[i+v].inc vc[i]; vc[i+v].mo vc[0] = 0 rc[0] = 1 for r in r: for i in countdown(10^5 - r, 0): rc[i+r].inc rc[i]; rc[i+r].mo rc[0] = 0 for i in 1..10^5: rc[i].inc rc[i-1]; rc[i].mo var cnt = 0 for v, c in vc: let rma = v div a let rmi = (v + b - 1) div b cnt.inc (rc[rma] - rc[max(0, rmi-1)]) * c cnt.mo echo cnt