結果

問題 No.60 魔法少女
ユーザー btkbtk
提出日時 2015-06-16 23:37:57
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 59,636 KB
実行使用メモリ 38,252 KB
最終ジャッジ日時 2023-09-21 09:08:43
合計ジャッジ時間 4,306 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 7 ms
7,440 KB
testcase_03 AC 16 ms
31,992 KB
testcase_04 AC 245 ms
38,060 KB
testcase_05 AC 185 ms
38,032 KB
testcase_06 AC 358 ms
38,032 KB
testcase_07 AC 263 ms
37,984 KB
testcase_08 AC 160 ms
37,960 KB
testcase_09 AC 78 ms
38,092 KB
testcase_10 AC 329 ms
38,000 KB
testcase_11 WA -
testcase_12 AC 124 ms
38,156 KB
testcase_13 AC 395 ms
38,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#define M 1600
#define m 500
typedef long long LL;
LL dam[M][M];
LL enemy[M][M];
using namespace std;
int main(){
	int N, K;
	cin >> N >> K;
	for (int i = 0; i < N; i++){
		int x, y, h;
		cin >> x >> y >> h;
		x += m, y += m;
		enemy[x][y]=h;
	}
	for (int k = 0; k < K; k++){
		int x, y, w, h, d;
		cin >> x >> y >> w >> h >> d;
		x += m, y += m;
		for (int i = 0; i <= w; i++){
			dam[x + i][y] += d;
			dam[x + i][y + h] -= d;
		}
	}
	LL res = 0;
	for (int i = 0; i < M; i++){
		LL tmp = 0;
		for (int j = 0; j < M; j++){
			tmp += dam[i][j];
			res += max(0ll, enemy[i][j] - tmp);
		}
	}
	cout << res << endl;
}
0