Submission #1540303


Source Code Expand

Copy
fun main(args: Array<String>) {
    val a = readLine()!!.groupBy { it }.values.map { it.size.toLong() }.toLongArray()
    var ans = 1L
    for (i in a.indices) {
        for (j in 0 until i) {
            ans += a[i] * a[j]
        }
    }
    println(ans)
}

Submission Info

Submission Time
Task B - Reverse and Compare
User AlexeyEnkov
Language Kotlin (1.0.0)
Score 500
Code Size 269 Byte
Status
Exec Time 309 ms
Memory 40020 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
All 500 / 500 sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt
Case Name Status Exec Time Memory
sample_01.txt 270 ms 36332 KB
sample_02.txt 229 ms 36192 KB
sample_03.txt 230 ms 36204 KB
subtask_1_01.txt 228 ms 38080 KB
subtask_1_02.txt 292 ms 39948 KB
subtask_1_03.txt 228 ms 36288 KB
subtask_1_04.txt 230 ms 34324 KB
subtask_1_05.txt 238 ms 36264 KB
subtask_1_06.txt 233 ms 36220 KB
subtask_1_07.txt 282 ms 39008 KB
subtask_1_08.txt 302 ms 37648 KB
subtask_1_09.txt 290 ms 37556 KB
subtask_1_10.txt 293 ms 39548 KB
subtask_1_11.txt 306 ms 35824 KB
subtask_1_12.txt 293 ms 39360 KB
subtask_1_13.txt 292 ms 39624 KB
subtask_1_14.txt 292 ms 39776 KB
subtask_1_15.txt 303 ms 37592 KB
subtask_1_16.txt 293 ms 39488 KB
subtask_1_17.txt 309 ms 40020 KB