結果
問題 | No.60 魔法少女 |
ユーザー | outline |
提出日時 | 2021-02-03 01:06:45 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 91 ms / 5,000 ms |
コード長 | 1,899 bytes |
コンパイル時間 | 1,418 ms |
コンパイル使用メモリ | 134,772 KB |
実行使用メモリ | 19,524 KB |
最終ジャッジ日時 | 2023-09-12 11:32:41 |
合計ジャッジ時間 | 2,836 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 14 ms
13,296 KB |
testcase_01 | AC | 14 ms
13,144 KB |
testcase_02 | AC | 14 ms
13,472 KB |
testcase_03 | AC | 11 ms
17,712 KB |
testcase_04 | AC | 50 ms
19,232 KB |
testcase_05 | AC | 57 ms
19,504 KB |
testcase_06 | AC | 86 ms
19,524 KB |
testcase_07 | AC | 67 ms
19,072 KB |
testcase_08 | AC | 46 ms
19,244 KB |
testcase_09 | AC | 24 ms
19,136 KB |
testcase_10 | AC | 82 ms
19,496 KB |
testcase_11 | AC | 20 ms
19,268 KB |
testcase_12 | AC | 42 ms
19,244 KB |
testcase_13 | AC | 91 ms
19,480 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <queue> #include <string> #include <map> #include <set> #include <stack> #include <tuple> #include <deque> #include <array> #include <numeric> #include <bitset> #include <iomanip> #include <cassert> #include <chrono> #include <random> #include <limits> #include <iterator> #include <functional> #include <sstream> #include <fstream> #include <complex> #include <cstring> #include <unordered_map> #include <unordered_set> using namespace std; using ll = long long; constexpr int INF = 1001001001; constexpr int mod = 1000000007; // constexpr int mod = 998244353; template<class T> inline bool chmax(T& x, T y){ if(x < y){ x = y; return true; } return false; } template<class T> inline bool chmin(T& x, T y){ if(x > y){ x = y; return true; } return false; } ll HP[1005][1005], S[1005][1005]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N, K, W, H, D; cin >> N >> K; vector<int> X(N), Y(N); for(int i = 0; i < N; ++i){ cin >> X[i] >> Y[i]; X[i] += 500; Y[i] += 500; cin >> HP[X[i]][Y[i]]; } for(int q = 0; q < K; ++q){ int x, y; cin >> x >> y >> W >> H >> D; x += 500; y += 500; S[x][y] += D; S[x][min(1000, y + H) + 1] -= D; S[min(1000, x + W) + 1][y] -= D; S[min(1000, x + W) + 1][min(1000, y + H) + 1] += D; } for(int x = 0; x <= 1000; ++x){ for(int y = 0; y <= 1000; ++y){ S[x][y + 1] += S[x][y]; } } for(int y = 0; y <= 1000; ++y){ for(int x = 0; x <= 1000; ++x){ S[x + 1][y] += S[x][y]; } } ll ans = 0; for(int i = 0; i < N; ++i){ ans += max(0LL, HP[X[i]][Y[i]] - S[X[i]][Y[i]]); } cout << ans << endl; return 0; }