結果

問題 No.60 魔法少女
ユーザー myantamyanta
提出日時 2017-05-11 03:24:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,067 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 45,868 KB
実行使用メモリ 10,756 KB
最終ジャッジ日時 2023-10-13 10:21:03
合計ジャッジ時間 9,999 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,700 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1,815 ms
4,348 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<vector>


using namespace std;


struct enemy_t
{
	int x, y, hp, f;
};

vector<enemy_t> ene;
vector<vector<enemy_t*> > ene_h, ene_v;


int main(void)
{
	int i, j, n, k;
	int x, y, w, h, d;
	int s, e, ans;

	while(scanf("%d%d", &n, &k)==2)
	{
		ene_h.clear();
		ene_v.clear();
		ene_h.resize(1001);
		ene_v.resize(1001);
		ene.resize(n);
		for(i=0;i<n;i++)
		{
			scanf("%d%d%d", &ene[i].x, &ene[i].y, &ene[i].hp);
			ene[i].f=-1;
			ene_h[ene[i].x+500].push_back(&ene[i]);
			ene_v[ene[i].y+500].push_back(&ene[i]);
		}

		for(i=0;i<k;i++)
		{
			scanf("%d%d%d%d%d", &x, &y, &w, &h, &d);
			s=max(x, -500);
			e=min(x+w, 500);
			for(j=s;j<=e;j++)
			{
				for(auto t: ene_h[j+500])
				{
					t->f=i;
				}
			}

			s=max(y, -500);
			e=min(y+h, 500);
			for(j=s;j<=e;j++)
			{
				for(auto t: ene_v[j+500])
				{
					if(t->f!=i) continue;
					t->hp-=d;
				}
			}
		}

		ans=0;
		for(i=0;i<n;i++)
		{
			if(ene[i].hp>0) ans+=ene[i].hp;
		}
/*
for(auto t: ene) printf("%d ", t.hp);
printf("\n");
*/
		printf("%d\n", ans);
	}
	return 0;
}
0