結果

問題 No.60 魔法少女
ユーザー h_nosonh_noson
提出日時 2016-03-24 11:56:45
言語 C++11
(gcc 11.4.0)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,047 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 55,336 KB
最終ジャッジ日時 2024-04-27 02:18:07
合計ジャッジ時間 1,054 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.cpp:14:20: error: elements of array ‘std::tuple<int, int, int> enemy [100000]’ have incomplete type
   14 | tuple<int,int,int> enemy[100000];
      |                    ^~~~~
main.cpp:14:20: error: storage size of ‘enemy’ isn’t known
main.cpp: In function ‘int main()’:
main.cpp:23:20: error: ‘make_tuple’ was not declared in this scope
   23 |         enemy[i] = make_tuple(x,y,hp);
      |                    ^~~~~~~~~~
main.cpp:4:1: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?
    3 | #include <algorithm>
  +++ |+#include <tuple>
    4 | using namespace std;
main.cpp:40:9: error: ‘tie’ was not declared in this scope
   40 |         tie(x,y,hp) = enemy[i];
      |         ^~~
main.cpp:40:9: note: ‘std::tie’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’?

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8

typedef long long ll;

tuple<int,int,int> enemy[100000];
int field[2000][2000];

int main() {
    int i, j, n, k, ans;
    cin >> n >> k;
    rep (i,n) {
        int x, y, hp;
        cin >> x >> y >> hp;
        enemy[i] = make_tuple(x,y,hp);
    }
    rep (i,k) {
        int ax, ay, w, h, d;
        cin >> ax >> ay >> w >> h >> d;
        ax += 500;
        ay += 500;
        field[ax][ay] += d;
        field[ax+w+1][ay] -= d;
        field[ax][ay+h+1] -= d;
        field[ax+w+1][ay+h+1] += d;
    }
    rep (i,1001) rep (j,1000) field[i][j+1] += field[i][j];
    rep (j,1001) rep (i,1000) field[i+1][j] += field[i][j];
    ans = 0;
    rep (i,n) {
        int x, y, hp;
        tie(x,y,hp) = enemy[i];
        ans += max(0,hp-field[x+500][y+500]);
    }
    cout << ans << endl;
    return 0;
}
0