結果
問題 | No.60 魔法少女 |
ユーザー | koba-e964 |
提出日時 | 2015-06-10 13:38:19 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 191 ms / 5,000 ms |
コード長 | 1,302 bytes |
コンパイル時間 | 704 ms |
コンパイル使用メモリ | 85,908 KB |
実行使用メモリ | 22,388 KB |
最終ジャッジ日時 | 2023-09-20 20:31:51 |
合計ジャッジ時間 | 3,728 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
21,828 KB |
testcase_01 | AC | 13 ms
21,896 KB |
testcase_02 | AC | 13 ms
22,080 KB |
testcase_03 | AC | 14 ms
21,952 KB |
testcase_04 | AC | 109 ms
21,940 KB |
testcase_05 | AC | 115 ms
22,324 KB |
testcase_06 | AC | 185 ms
22,384 KB |
testcase_07 | AC | 138 ms
22,148 KB |
testcase_08 | AC | 93 ms
22,112 KB |
testcase_09 | AC | 49 ms
22,152 KB |
testcase_10 | AC | 174 ms
22,260 KB |
testcase_11 | AC | 30 ms
22,040 KB |
testcase_12 | AC | 84 ms
22,072 KB |
testcase_13 | AC | 191 ms
22,388 KB |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <list> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> #define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++) using namespace std; typedef long long int ll; typedef vector<int> VI; typedef pair<int, int> PI; const double EPS=1e-9; const int N = 100100, B = 500, X = 1510; int x[N],y[N], hh[N]; ll tbl[X][X] = {}; int main(void){ int n,k; cin >> n >> k; REP(i, 0, n) { cin >> x[i] >> y[i] >> hh[i]; x[i] += B; y[i] += B; } REP(i, 0, k) { int ax, ay, w, h, d; cin >> ax >> ay >> w >> h >> d; ax += B; ay += B; tbl[ax][ay] += d; tbl[ax][ay + h + 1] -= d; tbl[ax + w + 1][ay] -= d; tbl[ax + w + 1][ay + h + 1] += d; } REP(i, 1, X) { REP(j, 0, X) { tbl[i][j] += tbl[i - 1][j]; } } REP(j, 1, X) { REP(i, 0, X) { tbl[i][j] += tbl[i][j - 1]; } } ll sum = 0; REP(i, 0, n) { sum += max(0LL, hh[i] - tbl[x[i]][y[i]]); } cout << sum << endl; }