結果
問題 |
No.60 魔法少女
|
ユーザー |
|
提出日時 | 2016-03-29 16:04:51 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 279 ms / 5,000 ms |
コード長 | 1,270 bytes |
コンパイル時間 | 11,766 ms |
コンパイル使用メモリ | 224,024 KB |
実行使用メモリ | 20,420 KB |
最終ジャッジ日時 | 2024-10-10 23:48:22 |
合計ジャッジ時間 | 14,761 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { sc.Split(bufio.ScanWords) n, k := nextInt(), nextInt() m := make([][]int, 1001) eria := make([][]int, 1001) for i := range m { m[i] = make([]int, 1001) eria[i] = make([]int, 1002) } for i := 0; i < n; i++ { x, y, hp := nextInt(), nextInt(), nextInt() m[y+500][x+500] = hp } for i := 0; i < k; i++ { x, y, w, h, d := nextInt(), nextInt(), nextInt(), nextInt(), nextInt() x += 500 y += 500 for j := 0; j <= h; j++ { if y+j > 1000 { continue } eria[y+j][x] += d xP := x + w + 1 if xP > 1001 { xP = 1001 } eria[y+j][xP] -= d } } dTotal := 0 for i, v := range eria { sum := 0 for j, v2 := range v[:1001] { sum += v2 if m[i][j] <= sum { continue } dTotal += m[i][j] - sum } } fmt.Println(dTotal) } func nextLine() string { sc.Scan() return sc.Text() } func nextInt() int { i, _ := strconv.Atoi(nextLine()) return i } func nextInt64() int64 { i, _ := strconv.ParseInt(nextLine(), 10, 64) return i } func nextUint64() uint64 { i, _ := strconv.ParseUint(nextLine(), 10, 64) return i } func nextFloat() float64 { f, _ := strconv.ParseFloat(nextLine(), 64) return f }