結果
問題 | No.1723 [Cherry 3rd Tune *] Dead on |
ユーザー | 箱星 |
提出日時 | 2021-10-29 21:23:29 |
言語 | Kotlin (1.9.23) |
結果 |
AC
|
実行時間 | 304 ms / 2,000 ms |
コード長 | 1,923 bytes |
コンパイル時間 | 14,560 ms |
コンパイル使用メモリ | 442,140 KB |
実行使用メモリ | 50,228 KB |
最終ジャッジ日時 | 2024-10-07 09:36:45 |
合計ジャッジ時間 | 27,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 259 ms
50,076 KB |
testcase_01 | AC | 278 ms
49,912 KB |
testcase_02 | AC | 261 ms
49,928 KB |
testcase_03 | AC | 263 ms
49,912 KB |
testcase_04 | AC | 287 ms
50,096 KB |
testcase_05 | AC | 277 ms
50,196 KB |
testcase_06 | AC | 274 ms
50,072 KB |
testcase_07 | AC | 272 ms
50,036 KB |
testcase_08 | AC | 283 ms
50,140 KB |
testcase_09 | AC | 270 ms
49,980 KB |
testcase_10 | AC | 280 ms
50,180 KB |
testcase_11 | AC | 268 ms
49,908 KB |
testcase_12 | AC | 266 ms
49,976 KB |
testcase_13 | AC | 268 ms
49,880 KB |
testcase_14 | AC | 267 ms
49,792 KB |
testcase_15 | AC | 296 ms
50,216 KB |
testcase_16 | AC | 280 ms
50,004 KB |
testcase_17 | AC | 300 ms
50,120 KB |
testcase_18 | AC | 283 ms
50,132 KB |
testcase_19 | AC | 279 ms
50,056 KB |
testcase_20 | AC | 277 ms
49,980 KB |
testcase_21 | AC | 304 ms
50,060 KB |
testcase_22 | AC | 284 ms
50,128 KB |
testcase_23 | AC | 289 ms
50,172 KB |
testcase_24 | AC | 283 ms
49,968 KB |
testcase_25 | AC | 293 ms
50,228 KB |
testcase_26 | AC | 282 ms
50,116 KB |
testcase_27 | AC | 265 ms
50,136 KB |
testcase_28 | AC | 293 ms
49,956 KB |
testcase_29 | AC | 293 ms
50,184 KB |
testcase_30 | AC | 290 ms
50,008 KB |
testcase_31 | AC | 286 ms
50,060 KB |
testcase_32 | AC | 275 ms
49,992 KB |
testcase_33 | AC | 264 ms
50,148 KB |
testcase_34 | AC | 264 ms
49,928 KB |
testcase_35 | AC | 265 ms
50,048 KB |
testcase_36 | AC | 301 ms
50,100 KB |
testcase_37 | AC | 273 ms
49,780 KB |
testcase_38 | AC | 265 ms
49,864 KB |
testcase_39 | AC | 263 ms
49,976 KB |
testcase_40 | AC | 264 ms
49,904 KB |
testcase_41 | AC | 265 ms
49,824 KB |
testcase_42 | AC | 266 ms
49,800 KB |
testcase_43 | AC | 258 ms
50,072 KB |
testcase_44 | AC | 274 ms
49,948 KB |
testcase_45 | AC | 270 ms
50,040 KB |
testcase_46 | AC | 264 ms
49,936 KB |
testcase_47 | AC | 264 ms
50,072 KB |
testcase_48 | AC | 282 ms
49,916 KB |
testcase_49 | AC | 278 ms
50,164 KB |
ソースコード
import java.io.PrintWriter import java.util.* import kotlin.math.* fun PrintWriter.solve() { val x = nextLong() val a = nextLong() val y = nextLong() val b = nextLong() // region prime factorization var number = x var divisor = 2L val pf = mutableMapOf<Long, Long>() while (divisor * divisor <= number) { var count = 0 while (number % divisor == 0L) { number /= divisor count++ } if (count > 0) { pf[divisor] = count * a } divisor++ } if (number > 1) pf[number] = a // endregion // region prime factorization number = y divisor = 2L val pf2 = mutableMapOf<Long, Long>() while (divisor * divisor <= number) { var count = 0 while (number % divisor == 0L) { number /= divisor count++ } if (count > 0) { pf2[divisor] = count * b } divisor++ } if (number > 1) pf2[number] = b // endregion for (k in pf2.keys) { if (!pf.containsKey(k)) { pf[k] = 0 } } if (pf.keys.all { pf[it]!! >= pf2[it] ?: 0 }) { println("Yes") } else { println("No") } } fun main() { Thread(null, { val writer = PrintWriter(System.out, false) writer.solve() writer.flush() }, "solve", abs(1L.shl(26))) .apply { setUncaughtExceptionHandler { _, e -> e.printStackTrace(); kotlin.system.exitProcess(1) } } .apply { start() }.join() } // region Scanner private var st = StringTokenizer("") private val br = System.`in`.bufferedReader() fun next(): String { while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine()) return st.nextToken() } fun nextInt() = next().toInt() fun nextLong() = next().toLong() fun nextLine() = br.readLine() fun nextDouble() = next().toDouble() // endregion