結果

問題 No.1338 Giant Class
ユーザー 👑 箱星箱星
提出日時 2021-01-15 21:43:15
言語 Kotlin
(1.9.23)
結果
WA  
実行時間 -
コード長 878 bytes
コンパイル時間 14,709 ms
コンパイル使用メモリ 440,856 KB
実行使用メモリ 91,100 KB
最終ジャッジ日時 2024-05-04 23:12:04
合計ジャッジ時間 24,405 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 253 ms
49,960 KB
testcase_01 AC 254 ms
49,936 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 576 ms
77,292 KB
testcase_07 AC 634 ms
90,920 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 418 ms
56,736 KB
testcase_12 WA -
testcase_13 AC 547 ms
76,708 KB
testcase_14 AC 446 ms
59,400 KB
testcase_15 AC 438 ms
62,264 KB
testcase_16 AC 385 ms
55,356 KB
testcase_17 AC 549 ms
76,768 KB
testcase_18 AC 416 ms
59,316 KB
testcase_19 AC 457 ms
64,560 KB
testcase_20 AC 669 ms
90,472 KB
testcase_21 AC 652 ms
90,624 KB
testcase_22 AC 670 ms
90,404 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] = 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