結果

問題 No.178 美しいWhitespace (1)
ユーザー 💕💖💞💕💖💞
提出日時 2018-07-24 22:02:23
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 334 bytes
コンパイル時間 13,322 ms
コンパイル使用メモリ 436,464 KB
実行使用メモリ 57,628 KB
最終ジャッジ日時 2024-04-30 19:03:18
合計ジャッジ時間 23,286 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 324 ms
56,896 KB
testcase_01 AC 323 ms
56,928 KB
testcase_02 AC 327 ms
56,896 KB
testcase_03 AC 326 ms
57,032 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 380 ms
57,356 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 384 ms
57,436 KB
testcase_12 AC 380 ms
57,472 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 378 ms
57,460 KB
testcase_19 WA -
testcase_20 AC 385 ms
57,316 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 389 ms
57,460 KB
testcase_24 AC 384 ms
57,276 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.kt:1:10: warning: parameter 'args' is never used
fun main(args:Array<String>) {
         ^
Main.kt:8:24: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Int
  val min = sizes.min()!!
                       ^

ソースコード

diff #

fun main(args:Array<String>) {
  val n = readLine()!!.toInt()
  val sizes = (1..n).map {
    val (a, b) = readLine()!!.split(" ").map(String::toInt)
    a+4*b
  }

  val min = sizes.min()!!
  val deltas = sizes.map { it - min }

  when {
    deltas.any { it%2 != 0 } -> -1
    else -> {
      deltas.sum()/2
    }
  }.run(::println)
}
0