Submission #64083871
Source Code Expand
Copy
fun main() {val N = readln().toInt()val A = readln().split( " ").map { it.toInt() }val countMap = mutableMapOf<Int, Int>()for (i in 0 until N) {val num = A[i]if (countMap[num] == null) {countMap[num] = i + 1} else if (countMap[num]!! > 0) {countMap[num] = -1}}// {持っている数: 持っている人の番号}var kazu = -1var bangou = -1var ans = -1for ((key, value) in countMap) {if (key > kazu && value > 0) {ans = value
fun main() { val N = readln().toInt() val A = readln().split( " ").map { it.toInt() } val countMap = mutableMapOf<Int, Int>() for (i in 0 until N) { val num = A[i] if (countMap[num] == null) { countMap[num] = i + 1 } else if (countMap[num]!! > 0) { countMap[num] = -1 } } // {持っている数: 持っている人の番号} var kazu = -1 var bangou = -1 var ans = -1 for ((key, value) in countMap) { if (key > kazu && value > 0) { ans = value kazu = key } } println(ans) }
Submission Info
Submission Time | |
---|---|
Task | C - Uniqueness |
User | pent |
Language | Kotlin (Kotlin/JVM 1.8.20) |
Score | 300 |
Code Size | 646 Byte |
Status | AC |
Exec Time | 509 ms |
Memory | 108760 KB |
Compile Error
Main.kt:17:9: warning: variable 'bangou' is never used var bangou = -1 ^
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt, sample_02.txt |
All | hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, sample_01.txt, sample_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 56 ms | 39872 KB |
hand_02.txt | AC | 56 ms | 39860 KB |
hand_03.txt | AC | 60 ms | 39780 KB |
random_01.txt | AC | 476 ms | 107920 KB |
random_02.txt | AC | 288 ms | 67348 KB |
random_03.txt | AC | 501 ms | 108760 KB |
random_04.txt | AC | 377 ms | 86304 KB |
random_05.txt | AC | 509 ms | 108184 KB |
random_06.txt | AC | 397 ms | 92208 KB |
random_07.txt | AC | 349 ms | 74180 KB |
random_08.txt | AC | 358 ms | 73784 KB |
random_09.txt | AC | 357 ms | 87808 KB |
random_10.txt | AC | 423 ms | 93448 KB |
random_11.txt | AC | 435 ms | 93304 KB |
random_12.txt | AC | 394 ms | 90740 KB |
random_13.txt | AC | 375 ms | 90276 KB |
random_14.txt | AC | 369 ms | 90428 KB |
random_15.txt | AC | 410 ms | 90340 KB |
random_16.txt | AC | 264 ms | 62132 KB |
random_17.txt | AC | 167 ms | 45100 KB |
random_18.txt | AC | 329 ms | 74304 KB |
random_19.txt | AC | 337 ms | 79376 KB |
random_20.txt | AC | 292 ms | 67452 KB |
random_21.txt | AC | 98 ms | 41868 KB |
random_22.txt | AC | 334 ms | 79004 KB |
random_23.txt | AC | 267 ms | 62128 KB |
sample_01.txt | AC | 57 ms | 39700 KB |
sample_02.txt | AC | 56 ms | 39752 KB |