結果
問題 | No.60 魔法少女 |
ユーザー |
![]() |
提出日時 | 2016-09-30 15:04:52 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,009 bytes |
コンパイル時間 | 765 ms |
コンパイル使用メモリ | 66,564 KB |
実行使用メモリ | 8,520 KB |
最終ジャッジ日時 | 2024-11-21 11:12:51 |
合計ジャッジ時間 | 4,173 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | RE * 10 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <queue> #include <cstdio> #include <cmath> using namespace std; typedef long long ll; #define rep(i,n) for(int i=0;i<(n);i++) const int INF = 1e9; int n, k; int x[100010], y[100010], hp[100010]; int imos[1010][1010]; //imos int main(void){ cin >> n >> k; rep(i, n){ cin >> x[i] >> y[i] >> hp[i]; x[i] += 500; y[i] += 500; } rep(i, 1010)rep(j, 1010) imos[i][j] = 0; rep(i, k){ int ax, ay, w, h, d; cin >> ax >> ay >> w >> h >> d; ax += 500; ay += 500; imos[ay][ax] += d;//左上 imos[ay][ax + w + 1] -= d;//右上 imos[ay + h + 1][ax] -= d;//左下 imos[ay + h + 1][ax + w + 1] += d;//右下 } //横方向への累積和 rep(i, 1010)rep(j, 1010){ imos[i][j] += imos[i][j - 1]; } //縦方向の累積和 rep(i, 1010)rep(j, 1010){ imos[i][j] += imos[i - 1][j]; } ll ans = 0; rep(i, n){ int ty = y[i], tx = x[i]; ans += max((ll)0, (ll)(hp[i] - imos[ty][tx])); } printf("%lld\n", ans); return 0; }