結果

問題 No.2897 2集合間距離
ユーザー tailstails
提出日時 2024-09-20 22:53:36
言語 cLay
(20240714-1)
結果
AC  
実行時間 619 ms / 3,500 ms
コード長 605 bytes
コンパイル時間 2,449 ms
コンパイル使用メモリ 174,276 KB
実行使用メモリ 26,368 KB
最終ジャッジ日時 2024-09-20 22:53:53
合計ジャッジ時間 16,837 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 493 ms
18,944 KB
testcase_01 AC 422 ms
18,944 KB
testcase_02 AC 488 ms
19,072 KB
testcase_03 AC 471 ms
19,072 KB
testcase_04 AC 465 ms
18,944 KB
testcase_05 AC 495 ms
18,944 KB
testcase_06 AC 489 ms
18,944 KB
testcase_07 AC 496 ms
18,944 KB
testcase_08 AC 471 ms
19,072 KB
testcase_09 AC 472 ms
18,944 KB
testcase_10 AC 501 ms
19,072 KB
testcase_11 AC 480 ms
19,072 KB
testcase_12 AC 511 ms
18,944 KB
testcase_13 AC 490 ms
19,072 KB
testcase_14 AC 481 ms
19,328 KB
testcase_15 AC 506 ms
19,584 KB
testcase_16 AC 580 ms
26,240 KB
testcase_17 AC 619 ms
26,368 KB
testcase_18 AC 582 ms
26,368 KB
testcase_19 AC 604 ms
26,240 KB
testcase_20 AC 579 ms
26,240 KB
testcase_21 AC 567 ms
26,240 KB
testcase_22 AC 584 ms
26,368 KB
testcase_23 AC 578 ms
26,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@n,a[n],b[n];
rep(i,n){
	ll@x,@y;
	a[i]=x+y;
	b[i]=x-y+999;
}
ll@m,c[m],d[m];
rep(i,m){
	ll@z,@w;
	c[i]=z+w;
	d[i]=z-w+999;
}
ll o=-1,h=2d3;
while(o<h-1){
	ll v=o+h>>1;
	int f[2d3][2d3]{};
	rep(i,n){
		ll x0=max(a[i]-v,0);
		ll x1=min(a[i]+v+1,2d3-1);
		ll y0=max(b[i]-v,0);
		ll y1=min(b[i]+v+1,2d3-1);
		f[y0][x0]+=1;
		f[y0][x1]-=1;
		f[y1][x0]-=1;
		f[y1][x1]+=1;
	}
	rep(y,2d3){
		ll e=0;
		rep(x,2d3){
			f[y][x]=e+=f[y][x];
		}
	}
	rep(x,2d3){
		ll e=0;
		rep(y,2d3){
			f[y][x]=e+=f[y][x];
		}
	}
	bool found=false;
	rep(i,m){
		if(f[d[i]][c[i]]){
			found=true;
		}
	}
	(found?h:o)=v;
}
wt(h);
0