結果

問題 No.60 魔法少女
ユーザー yukirinyukirin
提出日時 2016-03-29 18:23:38
言語 Go
(1.22.1)
結果
WA  
実行時間 -
コード長 1,094 bytes
コンパイル時間 11,916 ms
コンパイル使用メモリ 237,064 KB
実行使用メモリ 28,288 KB
最終ジャッジ日時 2024-04-19 07:10:36
合計ジャッジ時間 13,551 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
20,352 KB
testcase_01 AC 32 ms
20,352 KB
testcase_02 AC 31 ms
20,352 KB
testcase_03 AC 25 ms
20,480 KB
testcase_04 AC 54 ms
28,288 KB
testcase_05 AC 69 ms
28,288 KB
testcase_06 AC 87 ms
28,288 KB
testcase_07 WA -
testcase_08 AC 61 ms
28,288 KB
testcase_09 AC 44 ms
28,288 KB
testcase_10 AC 91 ms
28,288 KB
testcase_11 AC 46 ms
28,288 KB
testcase_12 AC 51 ms
28,288 KB
testcase_13 AC 97 ms
28,288 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 {
		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[:1001] {
		for j, v := range l[:1001] {
			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