結果
問題 | No.60 魔法少女 |
ユーザー | tkzw_21 |
提出日時 | 2015-03-23 15:33:48 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 237 ms / 5,000 ms |
コード長 | 900 bytes |
コンパイル時間 | 1,709 ms |
コンパイル使用メモリ | 148,632 KB |
実行使用メモリ | 38,796 KB |
最終ジャッジ日時 | 2023-09-11 09:45:11 |
合計ジャッジ時間 | 4,157 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 51 ms
38,684 KB |
testcase_01 | AC | 52 ms
38,736 KB |
testcase_02 | AC | 51 ms
38,660 KB |
testcase_03 | AC | 53 ms
38,736 KB |
testcase_04 | AC | 151 ms
38,640 KB |
testcase_05 | AC | 159 ms
38,596 KB |
testcase_06 | AC | 231 ms
38,616 KB |
testcase_07 | AC | 182 ms
38,608 KB |
testcase_08 | AC | 137 ms
38,740 KB |
testcase_09 | AC | 90 ms
38,792 KB |
testcase_10 | AC | 224 ms
38,636 KB |
testcase_11 | AC | 71 ms
38,660 KB |
testcase_12 | AC | 127 ms
38,796 KB |
testcase_13 | AC | 237 ms
38,608 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int INF = 1e9; const int MOD = 1e9+7; int main(void) { int N,K; cin >> N >> K; vector<vector<ll>> enemys(1510,vector<ll>(1510)); vector<vector<ll>> area(1510,vector<ll>(1510)); const int GETA = 500; for(int i=0;i<N;i++){ int x,y,hp;cin >> x >> y >> hp; enemys[y+GETA][x+GETA] += hp; } for(int i=0;i<K;i++){ int x,y,w,h,d;cin >> x >> y >> w >> h >> d; y += GETA; x += GETA; area[y][x] += d; area[y+h+1][x+w+1] += d; area[y+h+1][x] -= d; area[y][x+w+1] -= d; } for(int i=0;i<1510;i++){ for(int j=0;j<1510-1;j++){ area[i][j+1] += area[i][j]; } } for(int i=0;i<1510;i++){ for(int j=0;j<1510-1;j++){ area[j+1][i] += area[j][i]; } } ll ret = 0; for(int i=0;i<1510;i++){ for(int j=0;j<1510;j++){ ret += max(0LL,enemys[i][j] - area[i][j]); } } cout << ret << endl; return 0; }