結果
問題 | No.60 魔法少女 |
ユーザー | fine |
提出日時 | 2017-02-28 23:34:27 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 133 ms / 5,000 ms |
コード長 | 926 bytes |
コンパイル時間 | 1,651 ms |
コンパイル使用メモリ | 172,876 KB |
実行使用メモリ | 13,556 KB |
最終ジャッジ日時 | 2023-09-02 18:12:32 |
合計ジャッジ時間 | 4,463 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 8 ms
7,492 KB |
testcase_01 | AC | 8 ms
7,280 KB |
testcase_02 | AC | 8 ms
7,572 KB |
testcase_03 | AC | 8 ms
7,340 KB |
testcase_04 | AC | 48 ms
8,436 KB |
testcase_05 | AC | 98 ms
13,204 KB |
testcase_06 | AC | 128 ms
13,132 KB |
testcase_07 | AC | 91 ms
11,792 KB |
testcase_08 | AC | 62 ms
11,044 KB |
testcase_09 | AC | 26 ms
8,548 KB |
testcase_10 | AC | 121 ms
13,544 KB |
testcase_11 | AC | 22 ms
8,928 KB |
testcase_12 | AC | 66 ms
11,604 KB |
testcase_13 | AC | 133 ms
13,556 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; int imos[1010][1010]; int main() { cin.tie(0); ios::sync_with_stdio(false); int N, K; cin >> N >> K; map<P, int> m; for (int i = 0; i < N; i++) { int x, y, hp; cin >> x >> y >> hp; x += 500; y += 500; m[P(x, y)] = hp; } for (int i = 0; i < K; i++) { int x, y, w, h, d; cin >> x >> y >> w >> h >> d; x += 500; y += 500; int nx = min(x + w + 1, 1001), ny = min(y + h + 1, 1001); imos[x][y] += d; imos[nx][y] -= d; imos[x][ny] -= d; imos[nx][ny] += d; } for (int i = 0; i <= 1000; i++) { for (int j = 1; j <= 1000; j++) { imos[i][j] += imos[i][j - 1]; } } for (int i = 1; i <= 1000; i++) { for (int j = 0; j <= 1000; j++) { imos[i][j] += imos[i - 1][j]; } } int ans = 0; for (auto p : m) { ans += max(p.second - imos[p.first.first][p.first.second], 0); } cout << ans << endl; return 0; }