結果

問題 No.60 魔法少女
ユーザー CleyLCleyL
提出日時 2022-05-12 14:58:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 699 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 67,988 KB
実行使用メモリ 40,460 KB
最終ジャッジ日時 2023-09-27 14:27:15
合計ジャッジ時間 3,301 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
19,692 KB
testcase_01 AC 7 ms
19,768 KB
testcase_02 AC 8 ms
19,752 KB
testcase_03 AC 12 ms
34,312 KB
testcase_04 AC 92 ms
40,220 KB
testcase_05 AC 103 ms
40,248 KB
testcase_06 AC 165 ms
40,180 KB
testcase_07 AC 119 ms
40,228 KB
testcase_08 AC 81 ms
40,224 KB
testcase_09 AC 40 ms
40,168 KB
testcase_10 AC 155 ms
40,220 KB
testcase_11 AC 25 ms
38,128 KB
testcase_12 AC 73 ms
40,172 KB
testcase_13 AC 164 ms
40,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
int enem[2000][2000];
int dam[2000][2000];
int rudam[2000][2000];
int main(){
  int n,k;cin>>n>>k;


  for(int i = 0; n > i; i++){
    int x,y,hp;cin>>x>>y>>hp;
    enem[x+500][y+500] = hp;
  }

  for(int i = 0; k > i; i++){
    int ax,ay,w,h,d;cin>>ax>>ay>>w>>h>>d;
    dam[ax+500][ay+500] += d;
    dam[ax+500+w+1][ay+500] -= d;
    dam[ax+500][ay+500+h+1] -= d;
    dam[ax+500+w+1][ay+500+h+1] += d;
  }
  long long ans = 0;
  for(int i = 1; 1500 > i; i++){
    for(int j = 1; 1500 > j; j++){
      rudam[i][j] = rudam[i-1][j]+rudam[i][j-1]-rudam[i-1][j-1]+dam[i-1][j-1];
      ans += max(0,enem[i-1][j-1]-rudam[i][j]);
    }
  }
  cout << ans << endl;
}
0