Submission #50563487


Source Code Expand

Copy
fun main() {
val n = readln().toInt()
val p = readln().split(" ").map { it.toInt() }
val q = readln().toInt()
for(i in 0 until q) {
val (a, b) = readln().split(" ").map { it.toInt() }
val ai = p.indexOf(a)
val bi = p.indexOf(b)
if(ai < bi) {
println(a)
} else {
println(b)
}
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
fun main() {
    val n = readln().toInt()
    val p = readln().split(" ").map { it.toInt() }
    val q = readln().toInt()

    for(i in 0 until q) {
        val (a, b) = readln().split(" ").map { it.toInt() }
        val ai = p.indexOf(a)
        val bi = p.indexOf(b)

        if(ai < bi) {
            println(a)
        } else {
            println(b)
        }
    }

}

Submission Info

Submission Time
Task B - Which is ahead?
User dhirabayashi
Language Kotlin (Kotlin/JVM 1.8.20)
Score 200
Code Size 392 Byte
Status AC
Exec Time 69 ms
Memory 40264 KB

Compile Error

Main.kt:2:9: warning: variable 'n' is never used
    val n = readln().toInt()
        ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 14
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 56 ms 39868 KB
00_sample_02.txt AC 57 ms 39868 KB
01_test_01.txt AC 60 ms 39844 KB
01_test_02.txt AC 68 ms 40044 KB
01_test_03.txt AC 67 ms 40056 KB
01_test_04.txt AC 67 ms 39904 KB
01_test_05.txt AC 68 ms 40132 KB
01_test_06.txt AC 66 ms 39924 KB
01_test_07.txt AC 66 ms 39884 KB
01_test_08.txt AC 69 ms 39996 KB
01_test_09.txt AC 68 ms 40160 KB
01_test_10.txt AC 68 ms 40144 KB
01_test_11.txt AC 68 ms 40264 KB
01_test_12.txt AC 68 ms 39888 KB


2025-03-14 (Fri)
02:06:06 +00:00