提出 #53835367


ソースコード 拡げる

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

val INPUT: InputStream = System.`in`
val OUTPUT: PrintStream = System.out

val _reader = INPUT.bufferedReader()

var _tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (!_tokenizer.hasMoreTokens()) {
        _tokenizer = StringTokenizer(_reader.readLine() ?: return "", " ")
    }
    return _tokenizer.nextToken()
}

fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { readInt() }
fun readIntArray(n: Int) = IntArray(n) { readInt() }
fun readDoubles(n: Int) = List(n) { readDouble() }
fun readDoubleArray(n: Int) = DoubleArray(n) { readDouble() }
fun readLongs(n: Int) = List(n) { readLong() }
fun readLongArray(n: Int) = LongArray(n) { readLong() }

val _writer = PrintWriter(OUTPUT, false)
inline fun output(block: PrintWriter.() -> Unit) {
    _writer.apply(block).flush()
}

class MutableIntMap<K> : LinkedHashMap<K, Int>() {
    override operator fun get(key: K): Int = super.get(key) ?: 0

    fun increment(key: K, value: Int = 1) {
        this[key] = this[key] + value
    }

    companion object {
        fun <K> mutableIntMapOf(vararg pairs: Pair<K, Int>) =
            MutableIntMap<K>().apply { putAll(pairs) }
    }
}

typealias Pii = Pair<Int, Int>

fun readPii() = readInt() to readInt()
fun readPiis(n: Int) = List(n) { readPii() }

infix fun Int.hasBit(i: Int): Boolean = this and (1 shl i) > 0
infix fun Int.xorBit(i: Int): Int = this xor (1 shl i)
infix fun Long.hasBit(i: Int): Boolean = this and (1L shl i) > 0
infix fun Long.xorBit(i: Int): Long = this xor (1L shl i)

fun largerStackSize(stackSizeMegaBytes: Int = 100, action: () -> Unit) {
    Thread(null, action, "", 1024L * 1024 * stackSizeMegaBytes).apply {
        start()
        join()
    }
}

// #################################################################################################

fun solve() {
    val n = readInt()
    val m = readInt()
    val a = readInts(n).map { it to true }
    val b = readInts(m).map { it to false }
    val c = (a + b).sortedBy { it.first }
    println(if (c.zipWithNext { a, b -> a.second && b.second }.any { it }) "Yes" else "No")
}

fun main() {
//    repeat(readInt()) { solve() }
    solve()
}

提出情報

提出日時
問題 B - Piano 2
ユーザ wangchaohui
言語 Kotlin (Kotlin/JVM 1.8.20)
得点 200
コード長 2448 Byte
結果 AC
実行時間 67 ms
メモリ 42320 KiB

コンパイルエラー

Main.kt:73:33: warning: name shadowed: a
    println(if (c.zipWithNext { a, b -> a.second && b.second }.any { it }) "Yes" else "No")
                                ^
Main.kt:73:36: warning: name shadowed: b
    println(if (c.zipWithNext { a, b -> a.second && b.second }.any { it }) "Yes" else "No")
                                   ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 3
AC × 20
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt, 02_handmade_05.txt, 02_handmade_06.txt, 02_handmade_07.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 61 ms 42240 KiB
00_sample_02.txt AC 62 ms 42180 KiB
00_sample_03.txt AC 62 ms 41908 KiB
01_random_01.txt AC 62 ms 41988 KiB
01_random_02.txt AC 62 ms 42184 KiB
01_random_03.txt AC 67 ms 42084 KiB
01_random_04.txt AC 63 ms 42116 KiB
01_random_05.txt AC 64 ms 41996 KiB
01_random_06.txt AC 64 ms 42296 KiB
01_random_07.txt AC 67 ms 42256 KiB
01_random_08.txt AC 64 ms 42160 KiB
01_random_09.txt AC 65 ms 42112 KiB
01_random_10.txt AC 63 ms 42264 KiB
02_handmade_01.txt AC 65 ms 41988 KiB
02_handmade_02.txt AC 63 ms 42260 KiB
02_handmade_03.txt AC 67 ms 42228 KiB
02_handmade_04.txt AC 65 ms 42320 KiB
02_handmade_05.txt AC 63 ms 42128 KiB
02_handmade_06.txt AC 63 ms 42072 KiB
02_handmade_07.txt AC 65 ms 42260 KiB