結果
問題 | No.60 魔法少女 |
ユーザー | kimiyuki |
提出日時 | 2016-09-29 21:39:55 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 78 ms / 5,000 ms |
コード長 | 1,107 bytes |
コンパイル時間 | 359 ms |
コンパイル使用メモリ | 50,432 KB |
実行使用メモリ | 13,796 KB |
最終ジャッジ日時 | 2024-05-01 07:50:24 |
合計ジャッジ時間 | 1,701 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
10,888 KB |
testcase_01 | AC | 8 ms
11,008 KB |
testcase_02 | AC | 8 ms
11,008 KB |
testcase_03 | AC | 8 ms
11,008 KB |
testcase_04 | AC | 47 ms
12,416 KB |
testcase_05 | AC | 48 ms
12,560 KB |
testcase_06 | AC | 76 ms
13,784 KB |
testcase_07 | AC | 57 ms
13,012 KB |
testcase_08 | AC | 39 ms
12,160 KB |
testcase_09 | AC | 21 ms
11,592 KB |
testcase_10 | AC | 74 ms
13,672 KB |
testcase_11 | AC | 15 ms
11,392 KB |
testcase_12 | AC | 35 ms
12,032 KB |
testcase_13 | AC | 78 ms
13,796 KB |
ソースコード
#include <cstdio> #include <vector> #include <array> #define repeat(i,n) for (int i = 0; (i) < (n); ++(i)) typedef long long ll; using namespace std; const int size = 1001; const int offset = 500; int main() { int n, k; scanf("%d%d", &n, &k); vector<int> x(n), y(n), hp(n); repeat (i,n) scanf("%d%d%d", &x[i], &y[i], &hp[i]); vector<int> ax(k), ay(k), w(k), h(k), d(k); repeat (i,k) scanf("%d%d%d%d%d", &ax[i], &ay[i], &w[i], &h[i], &d[i]); array<array<ll,size+1>,size+1> imos = {}; repeat (i,k) { int lx = ax[i] + offset; int ly = ay[i] + offset; int rx = min(size, ax[i] + offset + w[i] + 1); int ry = min(size, ay[i] + offset + h[i] + 1); imos[ly][lx] += d[i]; imos[ly][rx] -= d[i]; imos[ry][lx] -= d[i]; imos[ry][rx] += d[i]; } repeat (y,size+1) repeat (x,size) imos[y][x+1] += imos[y][x]; repeat (x,size+1) repeat (y,size) imos[y+1][x] += imos[y][x]; ll ans = 0; repeat (i,n) { ans += max(0ll, hp[i] - imos[y[i] + offset][x[i] + offset]); } printf("%lld\n", ans); return 0; }