結果
問題 | No.1265 Balloon Survival |
ユーザー | rutilicus |
提出日時 | 2020-10-24 08:57:39 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 1,394 ms / 2,000 ms |
コード長 | 1,038 bytes |
コンパイル時間 | 15,994 ms |
コンパイル使用メモリ | 424,648 KB |
実行使用メモリ | 106,520 KB |
最終ジャッジ日時 | 2023-09-28 20:11:01 |
合計ジャッジ時間 | 41,818 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 308 ms
52,948 KB |
testcase_01 | AC | 310 ms
52,920 KB |
testcase_02 | AC | 309 ms
53,072 KB |
testcase_03 | AC | 319 ms
53,072 KB |
testcase_04 | AC | 326 ms
53,068 KB |
testcase_05 | AC | 325 ms
53,064 KB |
testcase_06 | AC | 328 ms
52,964 KB |
testcase_07 | AC | 321 ms
52,960 KB |
testcase_08 | AC | 320 ms
52,968 KB |
testcase_09 | AC | 317 ms
52,988 KB |
testcase_10 | AC | 320 ms
53,024 KB |
testcase_11 | AC | 318 ms
52,916 KB |
testcase_12 | AC | 319 ms
52,980 KB |
testcase_13 | AC | 315 ms
53,056 KB |
testcase_14 | AC | 478 ms
56,536 KB |
testcase_15 | AC | 458 ms
56,456 KB |
testcase_16 | AC | 402 ms
56,380 KB |
testcase_17 | AC | 830 ms
73,104 KB |
testcase_18 | AC | 424 ms
56,012 KB |
testcase_19 | AC | 421 ms
55,344 KB |
testcase_20 | AC | 477 ms
56,124 KB |
testcase_21 | AC | 612 ms
64,748 KB |
testcase_22 | AC | 518 ms
56,436 KB |
testcase_23 | AC | 514 ms
56,192 KB |
testcase_24 | AC | 1,357 ms
106,252 KB |
testcase_25 | AC | 1,297 ms
106,264 KB |
testcase_26 | AC | 1,394 ms
106,056 KB |
testcase_27 | AC | 1,324 ms
106,244 KB |
testcase_28 | AC | 1,364 ms
106,436 KB |
testcase_29 | AC | 1,350 ms
106,352 KB |
testcase_30 | AC | 1,345 ms
106,236 KB |
testcase_31 | AC | 1,300 ms
106,188 KB |
testcase_32 | AC | 1,318 ms
106,164 KB |
testcase_33 | AC | 1,316 ms
106,520 KB |
testcase_34 | AC | 347 ms
52,988 KB |
testcase_35 | AC | 321 ms
52,872 KB |
コンパイルメッセージ
Main.kt:42:13: warning: 'appendln(Int): 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) ^
ソースコード
import java.util.* fun main() { val builder = StringBuilder() val n = readInputLine().toInt() val balloon = Array(n) { val (x, y) = readInputLine().split(" ").map { it.toLong() } Pair(x, y) } val queue = PriorityQueue<Triple<Int, Int, Long>> { x, y -> x.third.compareTo(y.third) } for (i in 0 until n) { for (j in i + 1 until n) { val x = balloon[i].first - balloon[j].first val y = balloon[i].second - balloon[j].second queue.add(Triple(i, j, x * x + y * y)) } } var ans = 0 val removed = BooleanArray(n) while (queue.isNotEmpty()) { val (x, y, _) = queue.poll()!! if (removed[x] || removed[y]) { continue } if (x == 0 && !removed[y]) { ans++ } if (x != 0) { removed[x] = true } removed[y] = true } builder.appendln(ans) print(builder.toString()) } fun readInputLine(): String { return readLine()!! }