Submission #62775116


Source Code Expand

fun main() {
    val (N, M) = readln().split(" ").map { it.toInt() }
    val graph: MutableSet<Pair<Int, Int>> = mutableSetOf()
    var removeCount = 0
    for (i in 1..M) {
        var (u, v) = readln().split(" ").map { it.toInt() }
        if (u > v) {
            val tmp = u
            u = v
            v = tmp
        }

        if (u == v) {
            // 自己ループ
            removeCount++
        } else {
            if (graph.contains(u to v)) {
                removeCount++
            } else {
                graph.add(u to v)
            }
        }
    }

    println(removeCount)
}

Submission Info

Submission Time
Task C - Make it Simple
User bugtori
Language Kotlin (Kotlin/JVM 1.8.20)
Score 300
Code Size 633 Byte
Status AC
Exec Time 1406 ms
Memory 126632 KiB

Compile Error

Main.kt:2:10: warning: variable 'N' is never used
    val (N, M) = readln().split(" ").map { it.toInt() }
         ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 19
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_n_small_00.txt, 01_n_small_01.txt, 01_n_small_02.txt, 01_n_small_03.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 03_corner_00.txt, 03_corner_01.txt, 03_corner_02.txt, 03_corner_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 80 ms 39840 KiB
00_sample_01.txt AC 78 ms 40028 KiB
00_sample_02.txt AC 75 ms 39896 KiB
01_n_small_00.txt AC 431 ms 59092 KiB
01_n_small_01.txt AC 428 ms 61636 KiB
01_n_small_02.txt AC 449 ms 59152 KiB
01_n_small_03.txt AC 393 ms 60588 KiB
02_random_00.txt AC 851 ms 93164 KiB
02_random_01.txt AC 857 ms 93316 KiB
02_random_02.txt AC 1385 ms 126168 KiB
02_random_03.txt AC 1355 ms 125732 KiB
02_random_04.txt AC 1258 ms 111216 KiB
02_random_05.txt AC 991 ms 93336 KiB
02_random_06.txt AC 1302 ms 125288 KiB
02_random_07.txt AC 1406 ms 126632 KiB
03_corner_00.txt AC 998 ms 92924 KiB
03_corner_01.txt AC 1094 ms 93120 KiB
03_corner_02.txt AC 479 ms 60528 KiB
03_corner_03.txt AC 459 ms 59692 KiB