結果

問題 No.60 魔法少女
ユーザー furafura
提出日時 2020-06-07 12:46:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 628 bytes
コンパイル時間 1,923 ms
コンパイル使用メモリ 199,480 KB
実行使用メモリ 13,140 KB
最終ジャッジ日時 2023-08-25 04:42:56
合計ジャッジ時間 3,524 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
12,276 KB
testcase_01 AC 12 ms
12,364 KB
testcase_02 AC 12 ms
12,404 KB
testcase_03 AC 8 ms
12,368 KB
testcase_04 AC 47 ms
12,492 KB
testcase_05 AC 48 ms
13,108 KB
testcase_06 AC 78 ms
12,880 KB
testcase_07 AC 61 ms
12,656 KB
testcase_08 AC 40 ms
12,712 KB
testcase_09 AC 20 ms
12,568 KB
testcase_10 AC 73 ms
13,132 KB
testcase_11 AC 14 ms
12,604 KB
testcase_12 AC 35 ms
12,748 KB
testcase_13 AC 82 ms
13,140 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<int> x(n),y(n),hp(n);
	rep(i,n) scanf("%d%d%d",&x[i],&y[i],&hp[i]), x[i]+=500, y[i]+=500;

	static int sum[1502][1502];
	rep(i,k){
		int ax,ay,w,h,d; scanf("%d%d%d%d%d",&ax,&ay,&w,&h,&d); ax+=500; ay+=500;
		sum[ay][ax]+=d;
		sum[ay][ax+w+1]-=d;
		sum[ay+h+1][ax]-=d;
		sum[ay+h+1][ax+w+1]+=d;
	}
	rep(i,1502) rep(j,1501) sum[i][j+1]+=sum[i][j];
	rep(i,1501) rep(j,1502) sum[i+1][j]+=sum[i][j];

	int ans=0;
	rep(i,n) ans+=max(hp[i]-sum[y[i]][x[i]],0);
	printf("%d\n",ans);

	return 0;
}
0