結果

問題 No.1043 直列大学
ユーザー cunitaccunitac
提出日時 2020-05-01 22:38:30
言語 Nim
(2.0.2)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 710 bytes
コンパイル時間 5,218 ms
コンパイル使用メモリ 68,920 KB
実行使用メモリ 4,692 KB
最終ジャッジ日時 2023-09-25 15:15:00
合計ジャッジ時間 15,198 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
4,628 KB
testcase_01 AC 16 ms
4,528 KB
testcase_02 AC 37 ms
4,664 KB
testcase_03 AC 16 ms
4,528 KB
testcase_04 AC 16 ms
4,416 KB
testcase_05 AC 16 ms
4,668 KB
testcase_06 AC 16 ms
4,552 KB
testcase_07 AC 26 ms
4,496 KB
testcase_08 AC 27 ms
4,532 KB
testcase_09 AC 269 ms
4,556 KB
testcase_10 AC 319 ms
4,556 KB
testcase_11 AC 481 ms
4,556 KB
testcase_12 AC 521 ms
4,580 KB
testcase_13 AC 438 ms
4,440 KB
testcase_14 AC 463 ms
4,524 KB
testcase_15 AC 508 ms
4,556 KB
testcase_16 AC 453 ms
4,692 KB
testcase_17 AC 332 ms
4,508 KB
testcase_18 AC 334 ms
4,580 KB
testcase_19 AC 428 ms
4,512 KB
testcase_20 AC 326 ms
4,512 KB
testcase_21 AC 394 ms
4,552 KB
testcase_22 AC 413 ms
4,444 KB
testcase_23 AC 522 ms
4,572 KB
testcase_24 AC 366 ms
4,628 KB
testcase_25 AC 433 ms
4,568 KB
testcase_26 AC 465 ms
4,560 KB
testcase_27 AC 228 ms
4,572 KB
testcase_28 AC 428 ms
4,552 KB
testcase_29 WA -
testcase_30 AC 322 ms
4,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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
0