結果

問題 No.1490 スライムと爆弾
ユーザー kotatsugamekotatsugame
提出日時 2021-04-24 04:17:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 769 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 66,444 KB
実行使用メモリ 36,956 KB
最終ジャッジ日時 2023-09-17 13:24:46
合計ジャッジ時間 4,062 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,432 KB
testcase_01 AC 2 ms
5,488 KB
testcase_02 AC 3 ms
5,884 KB
testcase_03 AC 2 ms
5,684 KB
testcase_04 AC 2 ms
5,852 KB
testcase_05 AC 2 ms
5,856 KB
testcase_06 AC 2 ms
5,584 KB
testcase_07 AC 2 ms
5,728 KB
testcase_08 AC 2 ms
5,808 KB
testcase_09 AC 2 ms
5,668 KB
testcase_10 AC 2 ms
5,484 KB
testcase_11 AC 2 ms
5,492 KB
testcase_12 AC 2 ms
5,572 KB
testcase_13 AC 113 ms
26,112 KB
testcase_14 AC 136 ms
30,744 KB
testcase_15 AC 71 ms
29,896 KB
testcase_16 AC 104 ms
23,856 KB
testcase_17 AC 57 ms
24,072 KB
testcase_18 AC 137 ms
26,548 KB
testcase_19 AC 121 ms
34,332 KB
testcase_20 AC 89 ms
31,880 KB
testcase_21 AC 52 ms
31,828 KB
testcase_22 AC 123 ms
26,048 KB
testcase_23 AC 2 ms
5,428 KB
testcase_24 AC 2 ms
5,480 KB
testcase_25 AC 181 ms
36,956 KB
testcase_26 AC 179 ms
36,920 KB
testcase_27 AC 178 ms
36,896 KB
testcase_28 AC 114 ms
36,116 KB
testcase_29 AC 116 ms
36,156 KB
testcase_30 AC 250 ms
36,892 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int H,W,N,M;
int T[1<<17],U[1<<17],L[1<<17],R[1<<17],A[1<<17];
long S[2002][2002];
main()
{
	cin>>H>>W>>N>>M;
	for(int i=0;i<N;i++)
	{
		cin>>T[i]>>U[i]>>L[i]>>R[i]>>A[i];
		T[i]--;L[i]--;
	}
	for(int i=0;i<M;i++)
	{
		int x,y,b,c;cin>>x>>y>>b>>c;
		int lx=x-b,rx=x+b+1,ly=y-b,ry=y+b+1;
		if(lx<0)lx=0;
		if(ly<0)ly=0;
		if(rx>H+1)rx=H+1;
		if(ry>W+1)ry=W+1;
		S[lx][ly]+=c;
		S[lx][ry]-=c;
		S[rx][ly]-=c;
		S[rx][ry]+=c;
	}
	for(int _=0;_<2;_++)
	{
		for(int i=0;i<=H;i++)for(int j=0;j<=W;j++)
		{
			if(i)S[i][j]+=S[i-1][j];
			if(j)S[i][j]+=S[i][j-1];
			if(i&&j)S[i][j]-=S[i-1][j-1];
		}
	}
	int cnt=0;
	for(int i=0;i<N;i++)
	{
		if(S[U[i]][R[i]]-S[U[i]][L[i]]-S[T[i]][R[i]]+S[T[i]][L[i]]<A[i])cnt++;
	}
	cout<<cnt<<endl;
}
0