結果

問題 No.60 魔法少女
ユーザー yukirinyukirin
提出日時 2016-03-29 18:19:24
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,102 bytes
コンパイル時間 10,825 ms
コンパイル使用メモリ 229,312 KB
実行使用メモリ 28,652 KB
最終ジャッジ日時 2024-04-19 07:09:36
合計ジャッジ時間 12,209 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
14,696 KB
testcase_01 AC 18 ms
14,700 KB
testcase_02 AC 18 ms
14,696 KB
testcase_03 AC 14 ms
23,788 KB
testcase_04 AC 46 ms
28,648 KB
testcase_05 AC 48 ms
28,648 KB
testcase_06 AC 74 ms
28,648 KB
testcase_07 WA -
testcase_08 AC 40 ms
28,648 KB
testcase_09 AC 25 ms
28,652 KB
testcase_10 AC 69 ms
28,652 KB
testcase_11 AC 19 ms
28,648 KB
testcase_12 AC 39 ms
28,648 KB
testcase_13 AC 75 ms
28,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	m, eria := make([][]int, 1001), make([][]int, 1502)
	for i := range m {
		m[i] = make([]int, 1001)
	}
	for i := range eria {
		eria[i] = make([]int, 1502)
	}

	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()+500, nextInt()+500, nextInt(), nextInt(), nextInt()
		eria[y][x], eria[y+h+1][x+w+1] = d, d
		eria[y][x+w+1], eria[y+h+1][x] = -d, -d
	}

	for i, l := range eria[:1001] {
		for j := range l[1:1001] {
			eria[i][j+1] += eria[i][j]
		}
	}

	for i, l := range eria[1:1001] {
		for j := range l[:1001] {
			eria[i+1][j] += eria[i][j]
		}
	}

	total := 0
	for i, l := range m {
		for j, v := range l {
			if eria[i][j] >= v {
				continue
			}
			total += v - eria[i][j]
		}
	}

	fmt.Println(total)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(nextLine())
	return i
}
0