結果
問題 | No.60 魔法少女 |
ユーザー | mamekin |
提出日時 | 2015-01-15 23:15:55 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 186 ms / 5,000 ms |
コード長 | 1,357 bytes |
コンパイル時間 | 1,125 ms |
コンパイル使用メモリ | 93,988 KB |
実行使用メモリ | 8,160 KB |
最終ジャッジ日時 | 2023-09-04 13:17:48 |
合計ジャッジ時間 | 3,631 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 10 ms
7,300 KB |
testcase_01 | AC | 10 ms
7,340 KB |
testcase_02 | AC | 9 ms
7,284 KB |
testcase_03 | AC | 10 ms
7,348 KB |
testcase_04 | AC | 103 ms
7,620 KB |
testcase_05 | AC | 110 ms
8,008 KB |
testcase_06 | AC | 179 ms
8,060 KB |
testcase_07 | AC | 134 ms
7,768 KB |
testcase_08 | AC | 88 ms
8,052 KB |
testcase_09 | AC | 42 ms
7,668 KB |
testcase_10 | AC | 168 ms
8,000 KB |
testcase_11 | AC | 25 ms
7,556 KB |
testcase_12 | AC | 78 ms
7,780 KB |
testcase_13 | AC | 186 ms
8,160 KB |
ソースコード
#include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; int main() { int n, k; cin >> n >> k; vector<int> ax(n), ay(n), hp(n); for(int i=0; i<n; ++i) cin >> ax[i] >> ay[i] >> hp[i]; vector<vector<int> > mat(1002, vector<int>(1002, 0)); while(--k >= 0){ int x, y, w, h, d; cin >> x >> y >> w >> h >> d; int x1 = x + 500; int y1 = y + 500; int x2 = min(1000, x1 + w) + 1; int y2 = min(1000, y1 + h) + 1; mat[y1][x1] += d; mat[y1][x2] -= d; mat[y2][x1] -= d; mat[y2][x2] += d; } for(int y=0; y<1002; ++y){ for(int x=1; x<1002; ++x){ mat[y][x] += mat[y][x-1]; } } for(int x=0; x<1002; ++x){ for(int y=1; y<1002; ++y){ mat[y][x] += mat[y-1][x]; } } int ret = 0; for(int i=0; i<n; ++i){ int x = ax[i] + 500; int y = ay[i] + 500; ret += max(0, hp[i] - mat[y][x]); } cout << ret << endl; return 0; }