結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | エセ賢者 |
提出日時 | 2023-07-16 16:16:57 |
言語 | Kotlin (2.1.0) |
結果 |
AC
|
実行時間 | 444 ms / 2,000 ms |
コード長 | 2,326 bytes |
コンパイル時間 | 14,793 ms |
コンパイル使用メモリ | 433,520 KB |
実行使用メモリ | 71,216 KB |
スコア | 29,736 |
平均クエリ数 | 197.50 |
最終ジャッジ日時 | 2023-07-16 16:17:57 |
合計ジャッジ時間 | 56,470 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge14 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 429 ms
69,244 KB |
testcase_01 | AC | 335 ms
69,496 KB |
testcase_02 | AC | 348 ms
69,344 KB |
testcase_03 | AC | 369 ms
69,480 KB |
testcase_04 | AC | 345 ms
70,912 KB |
testcase_05 | AC | 334 ms
69,812 KB |
testcase_06 | AC | 376 ms
69,028 KB |
testcase_07 | AC | 351 ms
69,304 KB |
testcase_08 | AC | 373 ms
69,404 KB |
testcase_09 | AC | 414 ms
69,752 KB |
testcase_10 | AC | 438 ms
69,660 KB |
testcase_11 | AC | 329 ms
68,944 KB |
testcase_12 | AC | 374 ms
68,912 KB |
testcase_13 | AC | 359 ms
70,108 KB |
testcase_14 | AC | 361 ms
68,988 KB |
testcase_15 | AC | 364 ms
68,932 KB |
testcase_16 | AC | 340 ms
69,132 KB |
testcase_17 | AC | 348 ms
69,552 KB |
testcase_18 | AC | 359 ms
69,036 KB |
testcase_19 | AC | 353 ms
69,256 KB |
testcase_20 | AC | 346 ms
69,548 KB |
testcase_21 | AC | 348 ms
69,496 KB |
testcase_22 | AC | 353 ms
69,332 KB |
testcase_23 | AC | 344 ms
69,488 KB |
testcase_24 | AC | 353 ms
68,872 KB |
testcase_25 | AC | 362 ms
69,648 KB |
testcase_26 | AC | 359 ms
69,064 KB |
testcase_27 | AC | 350 ms
69,412 KB |
testcase_28 | AC | 398 ms
68,992 KB |
testcase_29 | AC | 377 ms
69,328 KB |
testcase_30 | AC | 416 ms
69,416 KB |
testcase_31 | AC | 401 ms
69,540 KB |
testcase_32 | AC | 367 ms
69,004 KB |
testcase_33 | AC | 366 ms
68,984 KB |
testcase_34 | AC | 354 ms
68,876 KB |
testcase_35 | AC | 368 ms
68,896 KB |
testcase_36 | AC | 362 ms
68,832 KB |
testcase_37 | AC | 375 ms
69,492 KB |
testcase_38 | AC | 365 ms
68,956 KB |
testcase_39 | AC | 337 ms
69,176 KB |
testcase_40 | AC | 341 ms
69,500 KB |
testcase_41 | AC | 353 ms
69,016 KB |
testcase_42 | AC | 352 ms
69,368 KB |
testcase_43 | AC | 375 ms
69,404 KB |
testcase_44 | AC | 379 ms
69,068 KB |
testcase_45 | AC | 365 ms
69,596 KB |
testcase_46 | AC | 354 ms
69,324 KB |
testcase_47 | AC | 330 ms
69,324 KB |
testcase_48 | AC | 349 ms
69,660 KB |
testcase_49 | AC | 444 ms
69,792 KB |
testcase_50 | AC | 354 ms
69,488 KB |
testcase_51 | AC | 329 ms
69,276 KB |
testcase_52 | AC | 367 ms
69,620 KB |
testcase_53 | AC | 354 ms
69,248 KB |
testcase_54 | AC | 353 ms
69,240 KB |
testcase_55 | AC | 365 ms
69,540 KB |
testcase_56 | AC | 346 ms
68,932 KB |
testcase_57 | AC | 381 ms
69,708 KB |
testcase_58 | AC | 358 ms
69,956 KB |
testcase_59 | AC | 353 ms
69,404 KB |
testcase_60 | AC | 357 ms
68,932 KB |
testcase_61 | AC | 360 ms
69,412 KB |
testcase_62 | AC | 350 ms
69,564 KB |
testcase_63 | AC | 355 ms
69,032 KB |
testcase_64 | AC | 354 ms
69,844 KB |
testcase_65 | AC | 356 ms
69,464 KB |
testcase_66 | AC | 354 ms
69,440 KB |
testcase_67 | AC | 359 ms
68,936 KB |
testcase_68 | AC | 404 ms
68,960 KB |
testcase_69 | AC | 376 ms
69,528 KB |
testcase_70 | AC | 353 ms
69,044 KB |
testcase_71 | AC | 376 ms
68,928 KB |
testcase_72 | AC | 337 ms
68,988 KB |
testcase_73 | AC | 349 ms
69,344 KB |
testcase_74 | AC | 363 ms
68,908 KB |
testcase_75 | AC | 362 ms
69,924 KB |
testcase_76 | AC | 377 ms
69,732 KB |
testcase_77 | AC | 366 ms
68,976 KB |
testcase_78 | AC | 356 ms
69,520 KB |
testcase_79 | AC | 371 ms
69,276 KB |
testcase_80 | AC | 369 ms
69,712 KB |
testcase_81 | AC | 362 ms
69,208 KB |
testcase_82 | AC | 375 ms
69,176 KB |
testcase_83 | AC | 388 ms
69,580 KB |
testcase_84 | AC | 391 ms
69,684 KB |
testcase_85 | AC | 357 ms
68,808 KB |
testcase_86 | AC | 389 ms
68,916 KB |
testcase_87 | AC | 349 ms
69,228 KB |
testcase_88 | AC | 360 ms
69,200 KB |
testcase_89 | AC | 385 ms
69,300 KB |
testcase_90 | AC | 378 ms
69,468 KB |
testcase_91 | AC | 383 ms
71,216 KB |
testcase_92 | AC | 361 ms
69,052 KB |
testcase_93 | AC | 331 ms
68,752 KB |
testcase_94 | AC | 349 ms
69,172 KB |
testcase_95 | AC | 376 ms
69,272 KB |
testcase_96 | AC | 331 ms
69,464 KB |
testcase_97 | AC | 362 ms
69,644 KB |
testcase_98 | AC | 357 ms
69,208 KB |
testcase_99 | AC | 354 ms
69,508 KB |
コンパイルメッセージ
Main.kt:10:10: warning: parameter 'args' is never used fun main(args: Array<String>) { ^ Main.kt:45:51: warning: unnecessary non-null assertion (!!) on a non-null receiver of type Enemy val near = sameLine.minBy { it.y }!! ^
ソースコード
private fun next() = readLine()!! private fun nextInt() = next().toInt() private fun nextLong() = next().toLong() private fun nextDouble() = next().toDouble() private fun nextList() = next().split(" ") private fun nextIntList() = next().split(" ").map { it.toInt() }.toIntArray() private fun nextLongList() = next().split(" ").map { it.toLong() }.toLongArray() private fun nextDoubleList() = next().split(" ").map { it.toDouble() }.toDoubleArray() fun main(args: Array<String>) { var turn = 0 var enemyList = mutableListOf<Enemy>() var own = 12 var power = 100 while (turn < 1000) { val n = nextInt() if (n == -1) { return } val newEnemyList = mutableListOf<Enemy>() for (enemy in enemyList) { val isAlive = enemy.nextTurn() if (isAlive) { newEnemyList.add(enemy) } } enemyList = newEnemyList for (i in 0 until n) { val hpx = nextIntList() enemyList.add(Enemy(hpx[2], 59, hpx[0], hpx[1])) } if (enemyList.isEmpty()) { println("S") } else { val sameLine = enemyList.filter { it.x == own } if (sameLine.isEmpty()) { if (Math.random() < 0.5) { println("R") own++ } else { println("L") own-- } } else { val near = sameLine.minBy { it.y }!! if (near.h > near.y * (power / 100)) { if (Math.random() < 0.5) { println("R") own++ } else { println("L") own-- } } else { val isAlive = near.hit(power / 100) println("S") if (!isAlive) { power += near.p } } } } turn++ } } class Enemy(var x: Int, var y: Int, var h: Int, var p: Int) { val maxH = h fun nextTurn(): Boolean { y-- return y >= 0 } fun hit(damage: Int): Boolean { h -= damage return h >= 0 } }