結果

問題 No.1412 Super Ryuo
コンテスト
ユーザー 👑 箱星
提出日時 2021-02-28 21:43:30
言語 Kotlin
(2.4.10 + ACL)
コンパイル:
kotlinc -cp /opt/aclib/ac_library.jar _filename_ -include-runtime -d main.jar
実行:
java -cp main.jar:/opt/aclib/ac_library.jar _class_
結果
AC  
実行時間 75 ms / 2,000 ms
+ 69µs
コード長 787 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 11,985 ms
コンパイル使用メモリ 478,636 KB
実行使用メモリ 43,204 KB
最終ジャッジ日時 2026-09-09 06:31:28
合計ジャッジ時間 14,459 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.PrintWriter
import java.util.*
import kotlin.math.absoluteValue

fun PrintWriter.solve() {
    val a = nextLong()
    val b = nextLong()
    val c = nextLong()
    val d = nextLong()
    val dist = (a - c).absoluteValue + (b - d).absoluteValue
    println(if (dist <= 3 || a == c || b == d) 1 else 2)
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve()
    writer.flush()
}

// region Scanner
private var st = StringTokenizer("")
private val br = System.`in`.bufferedReader()

fun next(): String {
    while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())
    return st.nextToken()
}

fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextLine() = br.readLine()!!
fun nextDouble() = next().toDouble()
// endregion
0