結果

問題 No.178 美しいWhitespace (1)
ユーザー 💕💖💞💕💖💞
提出日時 2018-07-24 22:11:56
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 337 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 13,154 ms
コンパイル使用メモリ 420,116 KB
実行使用メモリ 53,704 KB
最終ジャッジ日時 2023-08-13 00:11:30
合計ジャッジ時間 20,662 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 278 ms
52,884 KB
testcase_01 AC 279 ms
53,032 KB
testcase_02 AC 274 ms
53,008 KB
testcase_03 AC 271 ms
53,060 KB
testcase_04 AC 337 ms
53,400 KB
testcase_05 AC 326 ms
53,352 KB
testcase_06 AC 326 ms
53,268 KB
testcase_07 AC 326 ms
53,264 KB
testcase_08 AC 310 ms
53,328 KB
testcase_09 AC 308 ms
53,376 KB
testcase_10 AC 316 ms
53,608 KB
testcase_11 AC 321 ms
53,668 KB
testcase_12 AC 311 ms
53,320 KB
testcase_13 AC 320 ms
53,576 KB
testcase_14 AC 314 ms
53,596 KB
testcase_15 AC 315 ms
53,344 KB
testcase_16 AC 324 ms
53,228 KB
testcase_17 AC 305 ms
53,224 KB
testcase_18 AC 299 ms
53,384 KB
testcase_19 AC 310 ms
53,704 KB
testcase_20 AC 312 ms
53,320 KB
testcase_21 AC 315 ms
53,320 KB
testcase_22 AC 321 ms
53,204 KB
testcase_23 AC 307 ms
53,360 KB
testcase_24 AC 312 ms
53,448 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 Long
  val min = sizes.min()!!
                       ^
Main.kt:10:25: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Long
  val max = deltas.max()!!
                        ^

ソースコード

diff #

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

  val min = sizes.min()!!
  val deltas = sizes.map { it - min }
  val max = deltas.max()!!
  val deltas2 = deltas.map { max - it }
  when {
    deltas2.any { it%2L != 0L } -> -1L
    else -> {
      deltas2.sum()/2L
    }
  }.run(::println)
}
0