結果
問題 | No.970 数列変換マシン |
ユーザー | yakamoto |
提出日時 | 2020-01-17 21:32:20 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 667 ms / 2,000 ms |
コード長 | 1,159 bytes |
コンパイル時間 | 13,800 ms |
コンパイル使用メモリ | 422,268 KB |
実行使用メモリ | 65,616 KB |
最終ジャッジ日時 | 2023-09-08 01:43:48 |
合計ジャッジ時間 | 26,457 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 632 ms
61,484 KB |
testcase_01 | AC | 640 ms
61,492 KB |
testcase_02 | AC | 646 ms
61,204 KB |
testcase_03 | AC | 640 ms
61,592 KB |
testcase_04 | AC | 620 ms
61,456 KB |
testcase_05 | AC | 667 ms
65,616 KB |
testcase_06 | AC | 570 ms
59,440 KB |
testcase_07 | AC | 640 ms
61,384 KB |
testcase_08 | AC | 648 ms
61,500 KB |
testcase_09 | AC | 326 ms
57,304 KB |
testcase_10 | AC | 335 ms
57,096 KB |
testcase_11 | AC | 353 ms
57,052 KB |
testcase_12 | AC | 342 ms
57,312 KB |
testcase_13 | AC | 342 ms
56,840 KB |
testcase_14 | AC | 371 ms
57,292 KB |
testcase_15 | AC | 326 ms
56,696 KB |
testcase_16 | AC | 322 ms
56,872 KB |
testcase_17 | AC | 322 ms
56,820 KB |
testcase_18 | AC | 312 ms
56,740 KB |
testcase_19 | AC | 320 ms
59,000 KB |
testcase_20 | AC | 319 ms
56,860 KB |
testcase_21 | AC | 311 ms
56,916 KB |
testcase_22 | AC | 310 ms
56,888 KB |
testcase_23 | AC | 326 ms
57,060 KB |
testcase_24 | AC | 322 ms
56,704 KB |
ソースコード
import java.lang.Exception import kotlin.math.max import kotlin.math.min val MOD = 1_000_000_007 fun main() { val (N) = readInts() val Y = readInts() val s = Y.sum().toLong() val ans = mutableListOf<Long>() for (i in 0 until N) { val v = (s-Y[i])*(N-1)- s * (N - 2) ans.add(v) } println(ans.joinToString(" ")) } private val isDebug = try { // なんか本番でエラーでる System.getenv("MY_DEBUG") != null } catch (t: Throwable) { false } private fun readLn() = readLine()!! private fun readStrings() = readLn().split(" ") private fun readInts() = readStrings().map { it.toInt() }.toIntArray() private fun readLongs() = readStrings().map { it.toLong() }.toLongArray() private inline fun debug(msg: () -> String) { if (isDebug) System.err.println(msg()) } private fun debug(a: LongArray) { debug{a.joinToString(" ")} } private fun debug(a: IntArray) { debug{a.joinToString(" ")} } private fun debug(a: BooleanArray) { debug{a.map{if(it) 1 else 0}.joinToString("")} } private fun debugDim(A: Array<IntArray>) { if (isDebug) { for (a in A) { debug(a) } } }