結果

問題 No.1338 Giant Class
ユーザー 👑 箱
提出日時 2021-01-15 21:51:23
言語 Kotlin
(1.9.23)
結果
AC  
実行時間 722 ms / 2,000 ms
コード長 896 bytes
コンパイル時間 15,423 ms
コンパイル使用メモリ 420,792 KB
実行使用メモリ 67,252 KB
最終ジャッジ日時 2023-08-17 16:49:55
合計ジャッジ時間 27,462 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 257 ms
50,024 KB
testcase_01 AC 249 ms
50,216 KB
testcase_02 AC 597 ms
58,356 KB
testcase_03 AC 260 ms
50,616 KB
testcase_04 AC 273 ms
50,512 KB
testcase_05 AC 283 ms
50,324 KB
testcase_06 AC 587 ms
62,132 KB
testcase_07 AC 660 ms
64,580 KB
testcase_08 AC 577 ms
62,180 KB
testcase_09 AC 569 ms
62,272 KB
testcase_10 AC 697 ms
67,124 KB
testcase_11 AC 429 ms
57,028 KB
testcase_12 AC 589 ms
60,224 KB
testcase_13 AC 588 ms
62,316 KB
testcase_14 AC 425 ms
56,876 KB
testcase_15 AC 441 ms
57,832 KB
testcase_16 AC 394 ms
56,236 KB
testcase_17 AC 582 ms
62,660 KB
testcase_18 AC 421 ms
56,976 KB
testcase_19 AC 457 ms
59,928 KB
testcase_20 AC 718 ms
66,900 KB
testcase_21 AC 721 ms
66,492 KB
testcase_22 AC 722 ms
67,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

fun PrintWriter.solve() {
    val h = nextLong()
    val w = nextLong()
    val q = nextInt()
    val map = mutableMapOf<Long, Long>()
    var ans = h * w
    for (i in 0 until q) {
        val y = nextLong()
        val x = nextLong()
        ans -= max(0, h - y + 1 - (map[x] ?: 0))
        map[x] = max(map[x] ?: 0, h - y + 1)
        println(ans)
    }
}

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