結果
問題 | No.1043 直列大学 |
ユーザー |
![]() |
提出日時 | 2020-10-10 11:42:25 |
言語 | Kotlin (1.9.23) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,750 bytes |
コンパイル時間 | 17,807 ms |
コンパイル使用メモリ | 426,752 KB |
実行使用メモリ | 222,136 KB |
最終ジャッジ日時 | 2023-09-27 21:20:09 |
合計ジャッジ時間 | 38,847 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 329 ms
56,200 KB |
testcase_01 | AC | 305 ms
56,300 KB |
testcase_02 | AC | 379 ms
59,024 KB |
testcase_03 | AC | 304 ms
56,116 KB |
testcase_04 | AC | 298 ms
56,132 KB |
testcase_05 | AC | 297 ms
55,884 KB |
testcase_06 | AC | 301 ms
57,752 KB |
testcase_07 | AC | 373 ms
59,116 KB |
testcase_08 | AC | 376 ms
59,140 KB |
testcase_09 | AC | 688 ms
128,116 KB |
testcase_10 | AC | 682 ms
180,620 KB |
testcase_11 | WA | - |
testcase_12 | AC | 899 ms
222,100 KB |
testcase_13 | WA | - |
testcase_14 | AC | 847 ms
222,084 KB |
testcase_15 | AC | 871 ms
221,988 KB |
testcase_16 | AC | 823 ms
222,136 KB |
testcase_17 | AC | 686 ms
180,844 KB |
testcase_18 | AC | 692 ms
180,776 KB |
testcase_19 | AC | 773 ms
181,300 KB |
testcase_20 | AC | 704 ms
180,904 KB |
testcase_21 | AC | 752 ms
180,824 KB |
testcase_22 | AC | 775 ms
180,784 KB |
testcase_23 | AC | 902 ms
221,980 KB |
testcase_24 | AC | 751 ms
180,780 KB |
testcase_25 | AC | 773 ms
180,728 KB |
testcase_26 | AC | 860 ms
222,060 KB |
testcase_27 | AC | 593 ms
124,776 KB |
testcase_28 | AC | 789 ms
180,776 KB |
testcase_29 | AC | 501 ms
88,508 KB |
testcase_30 | AC | 693 ms
181,008 KB |
コンパイルメッセージ
Main.kt:57:13: warning: 'appendln(Long): kotlin.text.StringBuilder /* = java.lang.StringBuilder */' is deprecated. Use appendLine instead. Note that the new method always appends the line feed character '\n' regardless of the system line separator. builder.appendln(ans) ^
ソースコード
fun main() { val builder = StringBuilder() val mod = 1000000007L val (n, m) = readInputLine().split(" ").map { it.toInt() } val vCnt = Array(n) { LongArray(100000 + 1) } val rCnt = Array(m) { LongArray(100000 + 1) } readInputLine().split(" ").forEachIndexed { index, s -> val v = s.toInt() if (index != 0) { for (i in 1..(100000 - v)) { vCnt[index][i] = (vCnt[index][i] + vCnt[index - 1][i]) % mod vCnt[index][i + v] = (vCnt[index][i + v] + vCnt[index - 1][i]) % mod } } vCnt[index][v] = (vCnt[index][v] + 1) % mod } readInputLine().split(" ").forEachIndexed { index, s -> val r = s.toInt() if (index != 0) { for (i in 1..(100000 - r)) { rCnt[index][i] = (rCnt[index][i] + rCnt[index - 1][i]) % mod rCnt[index][i + r] = (rCnt[index][i + r] + rCnt[index - 1][i]) % mod } } rCnt[index][r] = (rCnt[index][r] + 1) % mod } val (a, b) = readInputLine().split(" ").map { it.toLong() } var ans = 0L val vCntSum = LongArray(100000 + 1) for (i in 1..100000) { vCntSum[i] = vCnt[n - 1][i] } for (i in 1..100000) { vCntSum[i] = (vCntSum[i] + vCntSum[i - 1]) % mod } for (i in 1..100000) { if (rCnt[m - 1][i] != 0L) { val l = i.toLong() * a val r = (i.toLong() * b).coerceAtMost(100000) if (l <= r) { ans = (ans + (vCntSum[r.toInt()] - vCntSum[l.toInt() - 1]) * rCnt[m - 1][i]) % mod } } } builder.appendln(ans) print(builder.toString()) } fun readInputLine(): String { return readLine()!! }