結果
| 問題 | No.60 魔法少女 | 
| コンテスト | |
| ユーザー |  tkmst201 | 
| 提出日時 | 2017-05-22 20:54:04 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 84 ms / 5,000 ms | 
| コード長 | 1,355 bytes | 
| コンパイル時間 | 1,362 ms | 
| コンパイル使用メモリ | 159,656 KB | 
| 実行使用メモリ | 12,528 KB | 
| 最終ジャッジ日時 | 2024-09-19 10:21:44 | 
| 合計ジャッジ時間 | 2,824 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:31:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   31 |                 scanf("%d %d %d", X + i, Y + i, HP + i);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:38:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |                 scanf("%d %d %d %d %d", &ax, &ay, &w, &h, &d);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;
int N, K;
int X[112345], Y[112345], HP[112345];
ll damage[1002][1002];
int main() {
	cin >> N >> K;
	REP(i, N) {
		scanf("%d %d %d", X + i, Y + i, HP + i);
		X[i] += 500;
		Y[i] += 500;
	}
	
	REP(i, K) {
		int ax, ay, w, h, d;
		scanf("%d %d %d %d %d", &ax, &ay, &w, &h, &d);
		
		ax += 500;
		ay += 500;
		
		damage[ay][ax] += d;
		damage[min(1001, ay + h + 1)][ax] -= d;
		damage[ay][min(1001, ax + w + 1)] -= d;
		damage[min(1001, ay + h + 1)][min(1001, ax + w + 1)] += d;
	}
	
	REP(i, 1001) FOR(j, 1, 1001) damage[i][j] += damage[i][j - 1];
	REP(j, 1001) FOR(i, 1, 1001) damage[i][j] += damage[i - 1][j];
	
	ll ans = 0;
	REP(i, N) {
		int now = damage[Y[i]][X[i]];
		ans += max(0, HP[i] - now);
	}
	cout << ans << endl;
	
	return 0;
}
            
            
            
        