結果
問題 | No.60 魔法少女 |
ユーザー | btk |
提出日時 | 2015-06-16 23:39:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 365 ms / 5,000 ms |
コード長 | 656 bytes |
コンパイル時間 | 404 ms |
コンパイル使用メモリ | 59,016 KB |
実行使用メモリ | 38,124 KB |
最終ジャッジ日時 | 2023-09-21 09:08:51 |
合計ジャッジ時間 | 3,441 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 6 ms
7,516 KB |
testcase_01 | AC | 6 ms
7,512 KB |
testcase_02 | AC | 6 ms
7,496 KB |
testcase_03 | AC | 12 ms
32,100 KB |
testcase_04 | AC | 235 ms
37,972 KB |
testcase_05 | AC | 180 ms
38,112 KB |
testcase_06 | AC | 350 ms
37,984 KB |
testcase_07 | AC | 253 ms
37,988 KB |
testcase_08 | AC | 169 ms
37,988 KB |
testcase_09 | AC | 77 ms
38,052 KB |
testcase_10 | AC | 326 ms
37,992 KB |
testcase_11 | AC | 30 ms
37,932 KB |
testcase_12 | AC | 118 ms
38,124 KB |
testcase_13 | AC | 365 ms
37,988 KB |
ソースコード
#include<iostream> #include<algorithm> #define M 1600 #define m 500 typedef long long LL; LL dam[M][M]; LL enemy[M][M]; using namespace std; int main(){ int N, K; cin >> N >> K; for (int i = 0; i < N; i++){ int x, y, h; cin >> x >> y >> h; x += m, y += m; enemy[x][y]=h; } for (int k = 0; k < K; k++){ int x, y, w, h, d; cin >> x >> y >> w >> h >> d; x += m, y += m; for (int i = 0; i <= w; i++){ dam[x + i][y] += d; dam[x + i][y + h+1] -= d; } } LL res = 0; for (int i = 0; i < M; i++){ LL tmp = 0; for (int j = 0; j < M; j++){ tmp += dam[i][j]; res += max(0ll, enemy[i][j] - tmp); } } cout << res << endl; }