結果

問題 No.60 魔法少女
ユーザー EmKjpEmKjp
提出日時 2015-03-21 15:08:39
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 86 ms / 5,000 ms
コード長 1,371 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 76,796 KB
実行使用メモリ 20,460 KB
最終ジャッジ日時 2023-09-11 09:14:05
合計ジャッジ時間 2,388 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
19,856 KB
testcase_01 AC 10 ms
19,916 KB
testcase_02 AC 11 ms
19,868 KB
testcase_03 AC 10 ms
19,868 KB
testcase_04 AC 51 ms
19,872 KB
testcase_05 AC 51 ms
20,340 KB
testcase_06 AC 82 ms
20,348 KB
testcase_07 AC 62 ms
20,380 KB
testcase_08 AC 43 ms
20,120 KB
testcase_09 AC 24 ms
19,968 KB
testcase_10 AC 78 ms
20,356 KB
testcase_11 AC 17 ms
19,952 KB
testcase_12 AC 37 ms
20,296 KB
testcase_13 AC 86 ms
20,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<numeric>
#include<functional>
#include<complex>

using namespace std;
#define BET(a,b,c) ((a)<=(b)&&(b)<(c))
#define FOR(i,n) for(int i=0,i##_end=(int(n));i<i##_end;i++)
#define SZ(x) (int)(x.size())
#define ALL(x) (x).begin(),(x).end()
#define MP make_pair
#define FOR_EACH(it,v) for(__typeof(v.begin()) it=v.begin(),it_end=v.end() ; it != it_end ; it++)
typedef vector<int> VI;
typedef vector<VI> VVI;

const int MAXN = 100000+5;

int X[MAXN];
int Y[MAXN];
int HP[MAXN];
const int offset = 500;
int D[2011][2011];

int main()
{
    int N,K;
    cin>>N>>K;
    FOR(i,N) scanf("%d%d%d",&X[i],&Y[i],&HP[i]);
    memset(D , 0 , sizeof(D));
    FOR(_,K){
        int ax,ay,w,h,d;
        scanf("%d%d%d%d%d",&ax,&ay,&w,&h,&d);
        ax += offset;
        ay += offset;
        D[ay][ax]+=d;
        D[ay+h+1][ax]-=d;
        D[ay][ax+w+1]-=d;
        D[ay+h+1][ax+w+1]+=d;
    }
    FOR(i,1010) FOR(j,1010) D[i][j+1] += D[i][j];
    FOR(i,1010) FOR(j,1010) D[j+1][i] += D[j][i];
    long long ans = 0 ;
    FOR(i,N){
        long long remain = HP[i] - D[Y[i]+offset][X[i]+offset];
        if(remain > 0) ans += remain;
    }
    cout<<ans<<endl;
    return 0;
}
0