結果

問題 No.60 魔法少女
ユーザー parukiparuki
提出日時 2016-10-07 09:44:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 1,268 bytes
コンパイル時間 3,151 ms
コンパイル使用メモリ 164,660 KB
実行使用メモリ 22,424 KB
最終ジャッジ日時 2023-08-14 01:12:09
合計ジャッジ時間 4,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
21,912 KB
testcase_01 AC 23 ms
21,856 KB
testcase_02 AC 23 ms
22,060 KB
testcase_03 AC 13 ms
21,888 KB
testcase_04 AC 53 ms
21,916 KB
testcase_05 AC 51 ms
22,344 KB
testcase_06 AC 84 ms
22,336 KB
testcase_07 AC 64 ms
22,244 KB
testcase_08 AC 44 ms
22,080 KB
testcase_09 AC 25 ms
21,944 KB
testcase_10 AC 79 ms
22,376 KB
testcase_11 AC 17 ms
21,912 KB
testcase_12 AC 37 ms
22,208 KB
testcase_13 AC 86 ms
22,424 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