結果

問題 No.60 魔法少女
ユーザー parukiparuki
提出日時 2016-10-07 09:44:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 89 ms / 5,000 ms
コード長 1,268 bytes
コンパイル時間 2,203 ms
コンパイル使用メモリ 167,264 KB
実行使用メモリ 22,568 KB
最終ジャッジ日時 2024-05-01 14:16:15
合計ジャッジ時間 3,378 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
22,092 KB
testcase_01 AC 22 ms
21,464 KB
testcase_02 AC 23 ms
21,460 KB
testcase_03 AC 13 ms
21,332 KB
testcase_04 AC 55 ms
21,680 KB
testcase_05 AC 52 ms
22,312 KB
testcase_06 AC 86 ms
22,452 KB
testcase_07 AC 67 ms
22,272 KB
testcase_08 AC 45 ms
22,032 KB
testcase_09 AC 25 ms
21,580 KB
testcase_10 AC 82 ms
22,328 KB
testcase_11 AC 18 ms
21,612 KB
testcase_12 AC 41 ms
22,272 KB
testcase_13 AC 89 ms
22,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

const int MA = 100001, R = 1510, OFF = 500;
int X[MA], Y[MA], HP[MA];
ll atk[R][R];

int main(){
    int N, K;
    cin >> N >> K;
    rep(i, N){
        scanf("%d%d%d", &X[i], &Y[i], &HP[i]);
        X[i] += OFF;
        Y[i] += OFF;
    }
    rep(i, K){
        int ax, ay, w, h, d;
        scanf("%d%d%d%d%d", &ax, &ay, &w, &h, &d);
        ax += OFF;
        ay += OFF;
        w++; h++;
        atk[ax][ay] += d;
        atk[ax + w][ay] -= d;
        atk[ax][ay + h] -= d;
        atk[ax + w][ay + h] += d;
    }
    rep(i, R - 1)rep(j, R)atk[i + 1][j] += atk[i][j];
    rep(i, R)rep(j, R - 1)atk[i][j + 1] += atk[i][j];
    ll ans = 0;
    rep(i, N){
        ll hp = HP[i] - atk[X[i]][Y[i]];
        if(hp > 0)ans += hp;
    }
    cout << ans << endl;
}
0