Submission #1339930
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 ⊃ ---------------------------------------------------------------------------------------------------*/ fun solve() { var N = ni() var A = na(N) A.sort() var ans = A.last() - A.first() out.println(ans) } //--------------------------------------------------------------------------------------------------- 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 | B - Traveling AtCoDeer Problem |
User | hamayanhamayan |
Language | Kotlin (1.0.0) |
Score | 200 |
Code Size | 2722 Byte |
Status | AC |
Exec Time | 180 ms |
Memory | 31560 KB |
Compile Error
Main.kt:36:9: warning: variable 'time' is never used var time = measureTimeMillis { ^ Main.kt:101: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 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | in1.txt, in2.txt, in3.txt, in4.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 180 ms | 28360 KB |
in2.txt | AC | 173 ms | 31432 KB |
in3.txt | AC | 175 ms | 31560 KB |
in4.txt | AC | 177 ms | 29760 KB |
s1.txt | AC | 175 ms | 29768 KB |
s2.txt | AC | 179 ms | 29764 KB |