結果

問題 No.1338 Giant Class
ユーザー first_vilfirst_vil
提出日時 2022-05-19 13:55:29
言語 Go
(1.22.1)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 17,613 ms
コンパイル使用メモリ 215,608 KB
実行使用メモリ 13,924 KB
最終ジャッジ日時 2023-10-17 22:54:11
合計ジャッジ時間 23,485 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 110 ms
7,876 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 98 ms
8,672 KB
testcase_07 AC 133 ms
8,644 KB
testcase_08 AC 90 ms
8,452 KB
testcase_09 AC 84 ms
8,488 KB
testcase_10 AC 144 ms
8,684 KB
testcase_11 AC 14 ms
4,372 KB
testcase_12 AC 98 ms
7,748 KB
testcase_13 AC 97 ms
8,956 KB
testcase_14 AC 24 ms
4,372 KB
testcase_15 AC 36 ms
4,528 KB
testcase_16 AC 13 ms
4,372 KB
testcase_17 AC 97 ms
9,024 KB
testcase_18 AC 25 ms
4,372 KB
testcase_19 AC 46 ms
6,300 KB
testcase_20 AC 170 ms
13,872 KB
testcase_21 AC 169 ms
13,924 KB
testcase_22 AC 169 ms
13,860 KB
権限があれば一括ダウンロードができます

ソースコード

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