結果

問題 No.1724 [Cherry 3rd Tune A] Lápiz labial de Sonia
ユーザー 👑 箱
提出日時 2021-08-11 00:57:10
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 1,379 ms / 2,000 ms
コード長 998 bytes
コンパイル時間 15,270 ms
コンパイル使用メモリ 435,156 KB
実行使用メモリ 117,892 KB
最終ジャッジ日時 2024-04-16 13:31:25
合計ジャッジ時間 49,981 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 328 ms
54,168 KB
testcase_01 AC 321 ms
54,312 KB
testcase_02 AC 329 ms
54,180 KB
testcase_03 AC 329 ms
54,092 KB
testcase_04 AC 331 ms
54,196 KB
testcase_05 AC 333 ms
54,320 KB
testcase_06 AC 329 ms
54,288 KB
testcase_07 AC 336 ms
54,260 KB
testcase_08 AC 333 ms
54,292 KB
testcase_09 AC 330 ms
54,388 KB
testcase_10 AC 336 ms
54,260 KB
testcase_11 AC 342 ms
54,468 KB
testcase_12 AC 347 ms
54,560 KB
testcase_13 AC 346 ms
54,532 KB
testcase_14 AC 352 ms
54,440 KB
testcase_15 AC 343 ms
54,480 KB
testcase_16 AC 944 ms
92,308 KB
testcase_17 AC 1,241 ms
109,844 KB
testcase_18 AC 1,036 ms
92,940 KB
testcase_19 AC 686 ms
75,996 KB
testcase_20 AC 756 ms
81,204 KB
testcase_21 AC 1,224 ms
117,692 KB
testcase_22 AC 1,241 ms
117,704 KB
testcase_23 AC 1,241 ms
117,660 KB
testcase_24 AC 1,258 ms
117,632 KB
testcase_25 AC 1,241 ms
117,528 KB
testcase_26 AC 1,289 ms
117,540 KB
testcase_27 AC 1,216 ms
117,616 KB
testcase_28 AC 1,228 ms
117,712 KB
testcase_29 AC 1,248 ms
117,548 KB
testcase_30 AC 1,379 ms
117,700 KB
testcase_31 AC 1,227 ms
117,892 KB
testcase_32 AC 916 ms
97,828 KB
testcase_33 AC 918 ms
97,892 KB
testcase_34 AC 945 ms
98,656 KB
testcase_35 AC 938 ms
97,528 KB
testcase_36 AC 314 ms
53,344 KB
testcase_37 AC 313 ms
53,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter
import java.util.*
import kotlin.math.*

fun PrintWriter.solve() {
    val n = nextInt()
    val k = nextInt()
    val a = Array(n) { nextLong() }
    val b = Array(n) { nextLong() }
    val lst = mutableListOf<Pair<Long, Int>>()
    for (i in 0 until n) {
        lst.add(a[i] - b[i] to i)
    }
    lst.sortByDescending { it.first }
    val choice = CharArray(n) { 'B' }
    for (i in 0 until k) {
        val ind = lst[i].second
        choice[ind] = 'A'
    }
    println(choice.joinToString(""))
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// 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
0