結果

問題 No.60 魔法少女
ユーザー koyoprokoyopro
提出日時 2015-09-30 18:10:51
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 877 bytes
コンパイル時間 1,626 ms
コンパイル使用メモリ 146,268 KB
実行使用メモリ 29,144 KB
最終ジャッジ日時 2023-09-27 00:33:13
合計ジャッジ時間 5,586 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
15,680 KB
testcase_01 AC 9 ms
15,676 KB
testcase_02 AC 8 ms
15,620 KB
testcase_03 AC 10 ms
24,016 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 27 ms
26,148 KB
testcase_12 WA -
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)
#define FOR(i, a, b) for(int i=(a);i<(b);i++)

#define MAX 2000
int N,K;
int M[MAX][MAX];
int P[MAX][MAX];

struct enemy { int x, y, hp; };

signed main()
{
    cin >> N >> K;

    vector<enemy> es(N);
    REP(i,N) {
        cin >> es[i].x >> es[i].y >> es[i].hp;
        es[i].x += 500;
        es[i].y += 500;
    }
    int x, y, W, H, D;
    REP(i,K) {
        cin >> x >> y >> W >> H >> D;
        x += 500;
        y += 500;
        REP(w,W+1) {
            M[x+w][y] += D;
            M[x+w][y+H+1] -= D;
        }
    }
    FOR(x,1,1100) {
        FOR(y,1,1100) {
            P[x][y] = M[x][y] + ((y > 0) ? P[x][y-1] : 0);
        }
    }
    int remain = 0;
    for (enemy e : es) {
        remain += max(0, e.hp - P[e.x][e.y]);
    }
    cout << remain << endl;
    return 0;
}
0