Submission #1340933


Source Code Expand

import java.io.*
import java.util.InputMismatchException
import java.io.IOException
import kotlin.system.measureTimeMillis
var out = PrintWriter(System.out)
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/

var line = intArrayOf(1, 400, 800, 1200, 1600, 2000, 2400, 2800, 5050)
fun solve() {
    var N = ni()
    var A = na(N)
    A.sort()

    var color:MutableSet<Int> = mutableSetOf()
    var non = 0
    for(a in A) {
        if(3200 <= a) {
            non++
            continue
        }

        for(j in 0..7) {
            if(a in line[j] until line[j + 1]) color.add(j)
        }
    }

    var max = color.size + non
    var min = Math.max(color.size, 1)
    out.println("$min $max")
}









//---------------------------------------------------------------------------------------------------
fun main(args: Array<String>) {
    var time = measureTimeMillis {
        solve()
        out.flush()
    }
    //println("$time ms")
}
//---------------------------------------------------------------------------------------------------
private var inbuf = ByteArray(1024)
private var lenbuf = 0
var ptrbuf = 0

var `is` = System.`in`

fun readByte(): Byte {
    if (lenbuf === -1) throw InputMismatchException()
    if (ptrbuf >= lenbuf) {
        ptrbuf = 0
        try {
            lenbuf = `is`.read(inbuf)
        } catch (e: IOException) {
            throw InputMismatchException()
        }

        if (lenbuf <= 0) return -1
    }
    return inbuf[ptrbuf++]
}


private fun isSpaceChar(c: Byte): Boolean {
    return !(c >= 33 && c <= 126)
}

private fun skip(): Byte {
    var b: Byte
    while (true) {
        b = readByte()
        if(b < 0 && isSpaceChar(b)) break
    }
    return b
}

private fun ns(): String {
    var b = skip()
    val sb = StringBuilder()
    while (!isSpaceChar(b)) {
        sb.appendCodePoint(b.toInt())
        b = readByte()
    }
    return sb.toString()
}

fun na(n: Int) = IntArray(n, {ni()})

fun ni(): Int {
    var num = 0
    var b: Byte
    var minus = false
    while (true) {
        b = readByte()
        if(b < 0) break
        if(b >= '0'.toByte() && b <= '9'.toByte() || b == '-'.toByte()) break

        if (b == '-'.toByte()) {
            minus = true
            b = readByte()
        }
    }

    while (true) {
        if (b >= '0'.toByte() && b <= '9'.toByte()) {
            num = num * 10 + (b - '0'.toByte())
        } else {
            return if (minus) -num else num
        }
        b = readByte()
    }
}

Submission Info

Submission Time
Task C - Colorful Leaderboard
User hamayanhamayan
Language Kotlin (1.0.0)
Score 300
Code Size 3105 Byte
Status AC
Exec Time 183 ms
Memory 31692 KB

Compile Error

Main.kt:50:9: warning: variable 'time' is never used
    var time = measureTimeMillis {
        ^
Main.kt:115:13: warning: the value 'readByte()' assigned to 'var b: kotlin.Byte defined in ni' is never used
            b = readByte()
            ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 8
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
in1.txt AC 180 ms 31692 KB
in2.txt AC 179 ms 27712 KB
in3.txt AC 181 ms 31556 KB
in4.txt AC 181 ms 31444 KB
in5.txt AC 183 ms 27712 KB
s1.txt AC 181 ms 29772 KB
s2.txt AC 179 ms 31552 KB
s3.txt AC 180 ms 31432 KB