結果

問題 No.60 魔法少女
ユーザー yukirinyukirin
提出日時 2016-03-29 18:25:50
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,080 bytes
コンパイル時間 12,935 ms
コンパイル使用メモリ 228,784 KB
実行使用メモリ 42,624 KB
最終ジャッジ日時 2024-04-19 07:11:23
合計ジャッジ時間 13,731 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
34,688 KB
testcase_01 AC 56 ms
34,688 KB
testcase_02 AC 56 ms
34,688 KB
testcase_03 AC 45 ms
34,688 KB
testcase_04 AC 74 ms
42,624 KB
testcase_05 AC 74 ms
42,624 KB
testcase_06 AC 100 ms
42,624 KB
testcase_07 WA -
testcase_08 AC 66 ms
42,624 KB
testcase_09 AC 51 ms
42,624 KB
testcase_10 AC 96 ms
42,624 KB
testcase_11 AC 43 ms
42,624 KB
testcase_12 AC 62 ms
42,624 KB
testcase_13 AC 101 ms
42,624 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, 2002)
	for i := range m {
		m[i] = make([]int, 1001)
	}
	for i := range eria {
		eria[i] = make([]int, 2002)
	}

	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 {
		for j := range l[1:] {
			eria[i][j+1] += eria[i][j]
		}
	}

	for i, l := range eria[1:] {
		for j := range l {
			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