結果

問題 No.1490 スライムと爆弾
コンテスト
ユーザー 👑 tails
提出日時 2023-03-09 19:21:10
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,343 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 105 ms
コンパイル使用メモリ 28,680 KB
最終ジャッジ日時 2026-02-24 01:12:59
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
main.c: In function 'f1':
main.c:18:13: error: expected ';' before 'i'
   18 |         rep(i,n)rd_skip_line();
      |             ^
main.c:9:32: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:18:13: error: 'i' undeclared (first use in this function)
   18 |         rep(i,n)rd_skip_line();
      |             ^
main.c:9:36: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:18:13: note: each undeclared identifier is reported only once for each function it appears in
   18 |         rep(i,n)rd_skip_line();
      |             ^
main.c:9:36: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c: In function 'f2':
main.c:36:13: error: expected ';' before 'x'
   36 |         rep(x,h+1){
      |             ^
main.c:9:32: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:36:13: error: 'x' undeclared (first use in this function)
   36 |         rep(x,h+1){
      |             ^
main.c:9:36: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:38:21: error: expected ';' before 'y'
   38 |                 rep(y,w+1){
      |                     ^
main.c:9:32: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                ^
main.c:38:21: error: 'y' undeclared (first use in this function)
   38 |                 rep(y,w+1){
      |                     ^
main.c:9:36: note: in definition of macro 'rep'
    9 | #define rep(v,e) for(typeof(e) v=0;v<e;++v)
      |                                    ^
main.c:42:13: error: expected ';' before 'y'
   42 |         rep(y,w+1){
      |             ^
m

ソースコード

diff #
raw source code

#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")

#define rd_init() char*rp=({char*mmap();mmap(0l,1l<<25,1,2,0,0ll);})
#define rd_skip_line() while(*rp++!=10)
#define rd() ({int _v=0,_c;while(_c=*rp++-48,_c>=0)_v=_v*10+_c;_v;})
#define wt(v) ({unsigned _z=v;do*--wp=_z%10+48;while(_z/=10);})
#define wt1(v) ({char wbuf[64],*wp=wbuf+sizeof wbuf;wt(v);write(1,wp,wbuf+sizeof wbuf-wp);})
#define rep(v,e) for(typeof(e) v=0;v<e;++v)
#define min(a,b) (a<=b?a:b)
#define max(a,b) (a>=b?a:b)

typedef unsigned long ulong;

long f[2002][2002];

void f1(char*rp,long h,long w,long n){
	rep(i,n)rd_skip_line();
	while(*rp){
		long x=rd();
		long y=rd();
		long b=rd();
		long c=rd();
		long x0=max(0,x-b);
		long x1=min(h,x+b)+1;
		long y0=max(0,y-b);
		long y1=min(w,y+b)+1;
		f[x0][y0]+=c;
		f[x0][y1]-=c;
		f[x1][y0]-=c;
		f[x1][y1]+=c;
	}
}

void f2(long h,long w){
	rep(x,h+1){
		long d=0,e=0;
		rep(y,w+1){
			f[x][y]=d+=e+=f[x][y];
		}
	}
	rep(y,w+1){
		long d=0,e=0;
		rep(x,h+1){
			f[x][y]=d+=e+=f[x][y];
		}
	}
}

long f3(char*rp,long n){
	long z=0;
	rep(i,n){
		long t=rd()-1;
		long u=rd();
		long l=rd()-1;
		long r=rd();
		long a=rd();
		z+=a>f[t][l]-f[t][r]-f[u][l]+f[u][r];
	}
	return z;
}

int main(){
	rd_init();
	long h=rd();
	long w=rd();
	long n=rd();
	rd_skip_line();
	f1(rp,h,w,n);
	f2(h,w);
	wt1(f3(rp,n));
	_exit(0);
}
0