結果

問題 No.1338 Giant Class
ユーザー first_vil
提出日時 2022-05-19 13:55:29
言語 Go
(1.23.4)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 17,171 ms
コンパイル使用メモリ 223,828 KB
実行使用メモリ 9,192 KB
最終ジャッジ日時 2024-09-17 20:03:05
合計ジャッジ時間 19,889 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

package main
import (
    "fmt"
    "os"
    "bufio"
)
func main() {
    r:=bufio.NewReader(os.Stdin)
    wr:=bufio.NewWriter(os.Stdout)
    defer wr.Flush()
    var h,w int64
    var q int
    fmt.Fscan(r,&h,&w,&q)
    m:=make(map[int64]int64)
    ans:=h*w
    for i:=0;i<q;i++ {
        var y,x int64
        fmt.Fscan(r,&y,&x)
        v,f:=m[x]
        if f {
            if v>y {
                ans-=v-y
                m[x]=y
            }
        } else {
            ans-=h+1-y
            m[x]=y
        }
        fmt.Fprintln(wr,ans)
    }
}
0