結果

問題 No.60 魔法少女
ユーザー mukadenodaioumukadenodaiou
提出日時 2018-03-30 11:49:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 230 ms / 5,000 ms
コード長 1,510 bytes
コンパイル時間 894 ms
コンパイル使用メモリ 102,496 KB
実行使用メモリ 37,232 KB
最終ジャッジ日時 2023-09-08 07:06:20
合計ジャッジ時間 4,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
36,084 KB
testcase_01 AC 60 ms
36,136 KB
testcase_02 AC 60 ms
36,120 KB
testcase_03 AC 59 ms
36,076 KB
testcase_04 AC 149 ms
36,344 KB
testcase_05 AC 155 ms
37,208 KB
testcase_06 AC 225 ms
37,120 KB
testcase_07 AC 182 ms
36,488 KB
testcase_08 AC 138 ms
36,192 KB
testcase_09 AC 89 ms
36,148 KB
testcase_10 AC 212 ms
37,184 KB
testcase_11 AC 73 ms
36,092 KB
testcase_12 AC 126 ms
36,484 KB
testcase_13 AC 230 ms
37,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const int mod = 1000000007;
const int INF = 1 << 30;
#define rep(i,n) for(int i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
ll ppow(ll x, ll n) {
	ll ans = 1;
	while (n > 0) {
		if ((n & 1) == 1)ans = ans + x;
		x = x * x;
		n >>= 1;
		ans %= mod;
	}
	return ans;
}
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll enemy[100000][3],m[2010][2010];//mは+1000して使う
int main(){
	ll n, k,sum=0;
	cin >> n >> k;
	rep(i, n)cin >> enemy[i][0] >> enemy[i][1] >> enemy[i][2];
	ll x, y, w, h, d;
	rep(i, k) {
		cin >> x >> y >> w >> h >> d;
		m[x + 1000][y + 1000] += d;
		m[x + 1000 + w + 1][y+1000] -= d;
		m[x + 1000][y + 1000 + h + 1] -= d;
		m[x + 1000 + w + 1][y + 1000 + h + 1] += d;
	}
	rep(j,2010)rep(i, 2010)if (i > 0)m[i][j] += m[i - 1][j];
	rep(i, 2010)rep(j, 2010)if (j > 0)m[i][j] += m[i][j - 1];
	rep(i, n) {
		sum += max((ll)0, enemy[i][2] - m[enemy[i][0] + 1000][enemy[i][1] + 1000]);
	}
	cout << sum << endl;
	return 0;
}
0