結果
問題 | No.60 魔法少女 |
ユーザー |
|
提出日時 | 2018-04-11 13:33:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 218 ms / 5,000 ms |
コード長 | 1,283 bytes |
コンパイル時間 | 647 ms |
コンパイル使用メモリ | 79,632 KB |
実行使用メモリ | 20,308 KB |
最終ジャッジ日時 | 2024-06-26 21:11:21 |
合計ジャッジ時間 | 3,792 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <cctype> #include <functional> #include <map> #include <cstdio> using namespace std; typedef long long ll; #define reps(i,s,n) for(int (i) = (s); (i) < (n); (i)++) #define rep(i,n) reps(i,0,n) const int INF = 1e9; struct enemy{ int x, y, hp; }; const int LENGTH = 2e3; int board[LENGTH][LENGTH]; int main(){ int n,k; int x,y,hp; int ax,ay,w,h,d; cin >> n >> k; vector<enemy> enemy_data; rep(i,n){ cin >> x >> y >> hp; x+=500; y+=500; enemy_data.push_back({x,y,hp}); } rep(i,k){ cin >> ax >> ay >> w >> h >> d; ax += 500; ay += 500; // board[ax][ay] += d; board[ax+w+1][ay] -= d; board[ax][ay+h+1] -= d; board[ax+w+1][ay+h+1] += d; } //横方向に累積 rep(j,LENGTH){//y rep(i,LENGTH-1){//x board[i+1][j] += board[i][j]; } } //縦方向に累積 rep(i,LENGTH){//x rep(j,LENGTH-1){//y board[i][j+1] += board[i][j]; } } int ans = 0; rep(i,n){ enemy e = enemy_data[i]; ans += max(e.hp - board[e.x][e.y],0); } cout << ans << endl; return 0; }