結果
問題 | No.60 魔法少女 |
ユーザー | shihu |
提出日時 | 2024-10-08 15:44:17 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 97 ms / 5,000 ms |
コード長 | 2,294 bytes |
コンパイル時間 | 6,751 ms |
コンパイル使用メモリ | 300,276 KB |
実行使用メモリ | 20,672 KB |
最終ジャッジ日時 | 2024-10-08 15:44:26 |
合計ジャッジ時間 | 8,908 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 15 ms
18,944 KB |
testcase_01 | AC | 17 ms
18,944 KB |
testcase_02 | AC | 16 ms
18,816 KB |
testcase_03 | AC | 17 ms
18,944 KB |
testcase_04 | AC | 72 ms
19,456 KB |
testcase_05 | AC | 59 ms
20,548 KB |
testcase_06 | AC | 93 ms
20,548 KB |
testcase_07 | AC | 72 ms
20,580 KB |
testcase_08 | AC | 52 ms
19,908 KB |
testcase_09 | AC | 30 ms
19,584 KB |
testcase_10 | AC | 97 ms
20,548 KB |
testcase_11 | AC | 22 ms
19,456 KB |
testcase_12 | AC | 45 ms
20,672 KB |
testcase_13 | AC | 95 ms
20,548 KB |
ソースコード
// #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using mint = modint998244353; // using mint = modint1000000007; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; using T = tuple<int, int, int>; using G = vector<vector<int>>; #define rep(i, n) for (ll i = 0; i < (n); ++i) #define rep2(i, a, b) for (ll i = a; i < (b); ++i) #define rrep2(i, a, b) for (ll i = a-1; i >= (b); --i) #define rep3(i, a, b, c) for (ll i = a; i < (b); i+=c) #define rng(a) a.begin(),a.end() #define rrng(a) a.rbegin(),a.rend() #define popcount __builtin_popcount #define popcountll __builtin_popcountll #define fi first #define se second #define UNIQUE(v) sort(rng(v)), v.erase(unique(rng(v)), v.end()) #define MIN(v) *min_element(rng(v)) #define MAX(v) *max_element(rng(v)) #define SUM(v) accumulate(rng(v),0) #define IN(v, x) (find(rng(v),x) != v.end()) template<class T> bool chmin(T &a,T b){if(a>b){a=b;return 1;}else return 0;} template<class T> bool chmax(T &a,T b){if(a<b){a=b;return 1;}else return 0;} template<class T> void printv(vector<T> &v){rep(i,v.size())cout<<v[i]<<" \n"[i==v.size()-1];} const ll dx[] = {0, 1, 0, -1}; const ll dy[] = {1, 0, -1, 0}; const ll dxx[] = {0, 1, 0, -1, 1, -1, 1, -1}; const ll dyy[] = {1, 0, -1, 0, 1, 1, -1, -1}; const ll LINF = 1001002003004005006ll; const int INF = 1001001001; int m = 500; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; vector dp(2000, vector(2000, 0)); vector<T> query; rep(i, n){ int x, y, h; cin >> x >> y >> h; x += m, y += m; query.emplace_back(x, y, h); } rep(i, k){ int x, y, w, h, d; cin >> x >> y >> w >> h >> d; x += m, y += m; dp[x][y] += d; dp[x+w+1][y] -= d; dp[x][y+h+1] -= d; dp[x+w+1][y+h+1] += d; } rep(i, 1001)rep(j, 1001){ dp[i][j+1] += dp[i][j]; } rep(i, 1001)rep(j, 1001){ dp[i+1][j] += dp[i][j]; } ll ans = 0; for (auto [x, y, h]: query){ if (h-dp[x][y] > 0) ans += h-dp[x][y]; } cout << ans << endl; return 0; }