結果

問題 No.60 魔法少女
ユーザー kaiyori_labkaiyori_lab
提出日時 2014-11-10 00:27:40
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 1,093 bytes
コンパイル時間 1,777 ms
コンパイル使用メモリ 141,892 KB
実行使用メモリ 24,592 KB
最終ジャッジ日時 2023-09-02 19:05:26
合計ジャッジ時間 4,589 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
7,604 KB
testcase_01 AC 6 ms
7,540 KB
testcase_02 AC 6 ms
7,284 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio;
import std.conv;
import std.string;
import std.algorithm;
import std.array;
import std.range;

void main(){
	
	int n, k; readf("%d %d\n", &n, &k);
	auto enemy = new int[3][n + 5];
	auto atack = new int[5][k + 5];
	auto matrix = new int[1005][1005];
	
	foreach(i; 0..n){
		enemy[i] = readln.split.map!(to!int).array;
	}
	foreach(i; 0..k){
		atack[i] = readln.split.map!(to!int).array;
	}
	
	foreach(a; atack){
		matrix[a[1] + 500][a[0] + 500] += a[4];
		matrix[a[1] + 500][a[0] + a[2] + 1 + 500] -= a[4];
		matrix[a[1] + a[3] + 1 + 500][a[0] + 500] -= a[4];
		matrix[a[1] + a[3] + 1 + 500][a[0] + a[2] + 1 + 500] += a[4];
	}
	
	foreach(y; 0..1000){
		foreach(x; 1..1000){
			matrix[y][x] += matrix[y][x-1];
		}
	}
	
	foreach(y; 1..1000){
		foreach(x; 0..1000){
			matrix[y][x] += matrix[y-1][x];
		}
	}
	
	int[] rest;
	foreach(e; enemy){
		rest ~= max(0, e[2] - matrix[e[1]+500][e[0]+500]);
	}
	
//	foreach(y; 500..510){
//		foreach(x; 500..510){
//			write(matrix[y][x], " ");
//		}
//		writeln;
//	}
	rest.sum.writeln;
}
0