結果

問題 No.60 魔法少女
ユーザー furafura
提出日時 2020-06-07 12:44:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 87 ms / 5,000 ms
コード長 632 bytes
コンパイル時間 2,286 ms
コンパイル使用メモリ 200,868 KB
実行使用メモリ 19,996 KB
最終ジャッジ日時 2023-08-25 04:42:45
合計ジャッジ時間 3,748 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
19,184 KB
testcase_01 AC 21 ms
19,124 KB
testcase_02 AC 21 ms
19,212 KB
testcase_03 AC 13 ms
19,348 KB
testcase_04 AC 55 ms
19,324 KB
testcase_05 AC 53 ms
19,928 KB
testcase_06 AC 84 ms
19,868 KB
testcase_07 AC 65 ms
19,580 KB
testcase_08 AC 46 ms
19,408 KB
testcase_09 AC 26 ms
19,516 KB
testcase_10 AC 81 ms
19,996 KB
testcase_11 AC 20 ms
19,468 KB
testcase_12 AC 40 ms
19,632 KB
testcase_13 AC 87 ms
19,904 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]+=1000, y[i]+=1000;

	static int sum[2002][2002];
	rep(i,k){
		int ax,ay,w,h,d; scanf("%d%d%d%d%d",&ax,&ay,&w,&h,&d); ax+=1000; ay+=1000;
		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,2002) rep(j,2001) sum[i][j+1]+=sum[i][j];
	rep(i,2001) rep(j,2002) 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