Submission #2251964


Source Code Expand

fun main(args: Array<String>) {
  val sc = if (args.size > 1) java.util.Scanner(java.io.File(args[1])) else java.util.Scanner(System.`in`)
  solve(sc)
}

fun solve(sc: java.util.Scanner) {
  val N = sc.nextInt()
  val a = IntArray(N) { sc.nextInt() }
  val r = mutableMapOf<Int, Int>()
  a.forEach {
    r[it] = (r[it] ?: 0) + 1
    r[it - 1] = (r[it - 1] ?: 0) + 1
    r[it + 1] = (r[it + 1] ?: 0) + 1
  }
  println(r.maxBy { it.value }?.value)
}

Submission Info

Submission Time
Task C - Together
User yh1224
Language Kotlin (1.0.0)
Score 300
Code Size 464 Byte
Status AC
Exec Time 652 ms
Memory 67500 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 9
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 186 ms 27552 KB
0_001.txt AC 176 ms 29336 KB
0_002.txt AC 180 ms 27556 KB
1_003.txt AC 179 ms 29356 KB
1_004.txt AC 543 ms 50524 KB
1_005.txt AC 557 ms 67500 KB
1_006.txt AC 549 ms 65168 KB
1_007.txt AC 560 ms 50504 KB
1_008.txt AC 652 ms 51264 KB