結果

問題 No.60 魔法少女
ユーザー kyuridenamidakyuridenamida
提出日時 2016-02-18 01:52:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 211 ms / 5,000 ms
コード長 1,184 bytes
コンパイル時間 2,284 ms
コンパイル使用メモリ 180,272 KB
実行使用メモリ 19,348 KB
最終ジャッジ日時 2023-10-22 06:28:21
合計ジャッジ時間 5,166 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
11,780 KB
testcase_01 AC 9 ms
11,780 KB
testcase_02 AC 9 ms
11,780 KB
testcase_03 AC 9 ms
17,980 KB
testcase_04 AC 115 ms
19,316 KB
testcase_05 AC 126 ms
19,260 KB
testcase_06 AC 203 ms
19,320 KB
testcase_07 AC 151 ms
19,296 KB
testcase_08 AC 99 ms
19,300 KB
testcase_09 AC 47 ms
19,176 KB
testcase_10 AC 192 ms
19,304 KB
testcase_11 AC 29 ms
18,632 KB
testcase_12 AC 90 ms
19,192 KB
testcase_13 AC 211 ms
19,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/tag_and_trait.hpp>
using namespace __gnu_pbds;
using namespace std;
#define rep(i,n) for(int (i) = 0 ; (i) < (int)(n) ; (i)++)
#define REP(i,a,b) for(int (i) = a ; (int)(i) <= (int)(b) ; (i)++)
#define all(n) (n).begin(),(n).end()
typedef long long ll;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<long long,long long> Pii;
typedef vector<Pii> VPii;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> set2;


int imos[1510][1510];
int hp[1510][1510];
int main(){
	int N,K;
	cin >> N >> K;
	rep(i,N){
		int X,Y,H;
		cin >> X >> Y >> H;
		X += 505;
		Y += 505;
		hp[Y][X] = H;
	}
	rep(i,K){
		int X,Y,W,H,D;
		cin >> X >> Y >> W >> H >> D;
		X += 505;
		Y += 505;
		imos[Y][X] += D;
		imos[Y][X+W+1] -= D;
		imos[Y+H+1][X] -= D;
		imos[Y+H+1][X+W+1] += D;	
	}
	REP(i,1,1008)REP(j,1,1008)
		imos[i][j] += imos[i][j-1];
	int ans = 0;
	REP(i,1,1008)REP(j,1,1008){
		imos[i][j] += imos[i-1][j];
		if( hp[i][j] && imos[i][j] < hp[i][j] ){
			ans += hp[i][j] - imos[i][j];
		}
	}
	cout << ans << endl;
}
0