結果

問題 No.1336 Union on Blackboard
ユーザー CuriousFairy315CuriousFairy315
提出日時 2021-01-15 21:42:27
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 497 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 13,572 ms
コンパイル使用メモリ 419,476 KB
実行使用メモリ 59,420 KB
最終ジャッジ日時 2023-08-17 16:32:09
合計ジャッジ時間 30,590 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 321 ms
53,956 KB
testcase_01 AC 458 ms
58,920 KB
testcase_02 AC 461 ms
57,136 KB
testcase_03 AC 462 ms
59,048 KB
testcase_04 AC 464 ms
58,988 KB
testcase_05 AC 463 ms
58,892 KB
testcase_06 AC 465 ms
59,000 KB
testcase_07 AC 456 ms
56,844 KB
testcase_08 AC 457 ms
57,116 KB
testcase_09 AC 467 ms
58,644 KB
testcase_10 AC 470 ms
57,124 KB
testcase_11 AC 465 ms
59,056 KB
testcase_12 AC 468 ms
59,276 KB
testcase_13 AC 476 ms
56,988 KB
testcase_14 AC 480 ms
57,324 KB
testcase_15 AC 465 ms
57,020 KB
testcase_16 AC 465 ms
57,512 KB
testcase_17 AC 463 ms
59,076 KB
testcase_18 AC 487 ms
58,852 KB
testcase_19 AC 463 ms
57,356 KB
testcase_20 AC 477 ms
59,420 KB
testcase_21 AC 478 ms
57,320 KB
testcase_22 AC 479 ms
58,840 KB
testcase_23 AC 485 ms
57,480 KB
testcase_24 AC 497 ms
59,112 KB
testcase_25 AC 477 ms
57,188 KB
testcase_26 AC 470 ms
57,108 KB
testcase_27 AC 485 ms
58,848 KB
testcase_28 AC 480 ms
59,220 KB
testcase_29 AC 492 ms
57,240 KB
testcase_30 AC 329 ms
55,644 KB
testcase_31 AC 344 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder

import java.util.*

class Main(private val args : Array<String>) : Runnable {
    override fun run() {
        solve(args)
    }
    private fun solve(@Suppress("UNUSED_PARAMETER") args: Array<String>) {
        Scanner(System.`in`).use { sc ->
            val T = sc.nextInt()
            repeat(T) {
                val N = sc.nextInt()
                val A = IntArray(N){sc.nextInt()}
                val MOD = 1_000_000_007
                var ans = A.fold(1){l, r -> (l.toLong() * (r + 1) % MOD).toInt()} - 1
                if (ans < 0) ans += MOD
                println(ans)
            }
        }
    }
}

/** 確保するメモリの大きさ(単位: MB)  */
private const val MEMORY: Long = 64

fun main(args: Array<String>) {
    Thread.setDefaultUncaughtExceptionHandler { _: Thread?, e: Throwable ->
        e.printStackTrace()
        System.exit(1)
    }
    Thread(null, Main(args = args), "", MEMORY * 1048576L).start()
}
0