結果

問題 No.2456 Stamp Art
ユーザー tailstails
提出日時 2023-09-02 22:38:55
言語 cLay
(20240104-1)
結果
AC  
実行時間 254 ms / 5,000 ms
コード長 585 bytes
コンパイル時間 5,361 ms
コンパイル使用メモリ 164,944 KB
実行使用メモリ 71,004 KB
最終ジャッジ日時 2023-09-02 22:39:24
合計ジャッジ時間 10,883 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 166 ms
71,004 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 196 ms
70,796 KB
testcase_07 AC 177 ms
70,844 KB
testcase_08 AC 165 ms
70,808 KB
testcase_09 AC 190 ms
70,716 KB
testcase_10 AC 227 ms
70,860 KB
testcase_11 AC 184 ms
70,772 KB
testcase_12 AC 196 ms
70,752 KB
testcase_13 AC 254 ms
70,792 KB
testcase_14 AC 229 ms
70,880 KB
testcase_15 AC 164 ms
70,760 KB
testcase_16 AC 97 ms
37,792 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,372 KB
testcase_19 AC 113 ms
48,440 KB
testcase_20 AC 202 ms
70,772 KB
testcase_21 AC 220 ms
64,456 KB
testcase_22 AC 209 ms
70,776 KB
testcase_23 AC 11 ms
7,172 KB
testcase_24 AC 18 ms
9,460 KB
testcase_25 AC 1 ms
4,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@h,@w,a[h+2][w+2]{},n=0;
string@s[h];

rep(y,h){
	rep(x,w){
		if(s[y][x]=='#'){
			ll b=h;
			b<?=a[y+0][x+1];
			b<?=a[y+1][x+0];
			b<?=a[y+0][x+0];
			a[y+1][x+1]=b+1;
			n+=1;
		}
	}
}

ll c[h+1][w+1];
ll d[w+1];

ll ok=1,ng=h+1;
while(ok+1<ng){
	rep(y,h+1){
		rep(x,w+1){
			c[y][x]=0;
		}
	}
	rep(x,w+1){
		d[x]=0;
	}
	ll k=ok+ng>>1;
	ll m=n;
	rep(y,h){
		ll e=0;
		rep(x,w){
			if(y+k<=h&&x+k<=w&&a[y+k][x+k]>=k){
				c[y][x]+=1;
				c[y][x+k]-=1;
				c[y+k][x]-=1;
				c[y+k][x+k]+=1;
			}
			e+=d[x]+=c[y][x];
			m-=e>0;
		}
	}
	if(m){
		ng=k;
	}else{
		ok=k;
	}
}

wt(ok);
0