結果

問題 No.60 魔法少女
ユーザー Kutimoti_TKutimoti_T
提出日時 2018-01-10 23:55:01
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 187 ms / 5,000 ms
コード長 1,091 bytes
コンパイル時間 502 ms
コンパイル使用メモリ 68,376 KB
実行使用メモリ 24,676 KB
最終ジャッジ日時 2023-08-25 10:42:51
合計ジャッジ時間 3,610 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
17,288 KB
testcase_01 AC 16 ms
17,076 KB
testcase_02 AC 17 ms
17,144 KB
testcase_03 AC 11 ms
21,624 KB
testcase_04 AC 105 ms
23,896 KB
testcase_05 AC 110 ms
24,676 KB
testcase_06 AC 181 ms
24,520 KB
testcase_07 AC 135 ms
24,404 KB
testcase_08 AC 89 ms
24,492 KB
testcase_09 AC 45 ms
23,948 KB
testcase_10 AC 170 ms
24,496 KB
testcase_11 AC 27 ms
23,780 KB
testcase_12 AC 79 ms
24,404 KB
testcase_13 AC 187 ms
24,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
using namespace std;

#define FOR(i, s, e) for (int i = (s); i <= (e); i++)

typedef long long ll;

ll N;
ll K;
int X[100000],Y[100000],HP[100000];

ll imos[1600][1600];

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

    FOR(i,0,N - 1)
    {
        cin >> X[i] >> Y[i] >> HP[i];
        X[i] += 500;
        Y[i] += 500;
    }

    int ax,ay,w,h,d;

    FOR(i,0,K - 1)
    {
        cin >> ax >> ay >> w >> h >> d;
        ax += 500;
        ay += 500;
        imos[ax][ay] += d;
        imos[ax][ay + h + 1] += -d;
        imos[ax + w + 1][ay] += -d;
        imos[ax + w + 1][ay + h + 1] += d;
    }

    FOR(i,0,1000)
    {
        FOR(j,0,1000)
        {
            imos[i][j + 1] += imos[i][j];
        }
    }
    FOR(j,0,1000)
    {
        FOR(i,0,1000)
        {
            imos[i + 1][j] += imos[i][j];
        }
    }

    ll result = 0;

    FOR(i,0,N - 1)
    {
        result += max(0LL,HP[i] - imos[X[i]][Y[i]]);
    }

    cout << result << endl;
    return 0;
}
0