結果

問題 No.2456 Stamp Art
ユーザー tailstails
提出日時 2023-09-02 22:37:42
言語 cLay
(20240104-1)
結果
AC  
実行時間 293 ms / 5,000 ms
コード長 616 bytes
コンパイル時間 4,789 ms
コンパイル使用メモリ 164,988 KB
実行使用メモリ 70,968 KB
最終ジャッジ日時 2023-09-02 22:37:55
合計ジャッジ時間 10,865 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 2 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 206 ms
70,744 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 235 ms
70,784 KB
testcase_07 AC 184 ms
70,728 KB
testcase_08 AC 183 ms
70,784 KB
testcase_09 AC 225 ms
70,808 KB
testcase_10 AC 293 ms
70,804 KB
testcase_11 AC 218 ms
70,680 KB
testcase_12 AC 237 ms
70,720 KB
testcase_13 AC 283 ms
70,748 KB
testcase_14 AC 286 ms
70,744 KB
testcase_15 AC 203 ms
70,808 KB
testcase_16 AC 110 ms
37,836 KB
testcase_17 AC 2 ms
4,368 KB
testcase_18 AC 2 ms
4,368 KB
testcase_19 AC 133 ms
48,432 KB
testcase_20 AC 249 ms
70,716 KB
testcase_21 AC 222 ms
64,428 KB
testcase_22 AC 254 ms
70,968 KB
testcase_23 AC 12 ms
7,244 KB
testcase_24 AC 22 ms
9,192 KB
testcase_25 AC 1 ms
4,372 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(a[y+1][x+1]){
				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