結果

問題 No.2657 Falling Block Game
ユーザー kotatsugamekotatsugame
提出日時 2024-03-01 21:50:42
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 417 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 741 ms
コンパイル使用メモリ 79,260 KB
実行使用メモリ 9,900 KB
最終ジャッジ日時 2024-03-01 21:50:56
合計ジャッジ時間 6,989 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,516 KB
testcase_01 AC 3 ms
7,516 KB
testcase_02 AC 3 ms
7,516 KB
testcase_03 AC 3 ms
7,516 KB
testcase_04 AC 12 ms
7,644 KB
testcase_05 AC 417 ms
9,900 KB
testcase_06 AC 217 ms
8,992 KB
testcase_07 AC 406 ms
9,900 KB
testcase_08 AC 161 ms
8,156 KB
testcase_09 AC 25 ms
7,644 KB
testcase_10 AC 179 ms
9,900 KB
testcase_11 AC 177 ms
9,900 KB
testcase_12 AC 179 ms
9,900 KB
testcase_13 AC 181 ms
9,900 KB
testcase_14 AC 177 ms
9,900 KB
testcase_15 AC 179 ms
9,900 KB
testcase_16 AC 179 ms
9,900 KB
testcase_17 AC 178 ms
9,900 KB
testcase_18 AC 178 ms
9,900 KB
testcase_19 AC 178 ms
9,900 KB
testcase_20 AC 137 ms
8,156 KB
testcase_21 AC 136 ms
8,156 KB
testcase_22 AC 137 ms
8,156 KB
testcase_23 AC 137 ms
8,156 KB
testcase_24 AC 139 ms
8,156 KB
testcase_25 AC 136 ms
8,156 KB
testcase_26 AC 137 ms
8,156 KB
testcase_27 AC 138 ms
8,156 KB
testcase_28 AC 137 ms
8,156 KB
testcase_29 AC 136 ms
8,156 KB
testcase_30 AC 29 ms
7,644 KB
testcase_31 AC 28 ms
7,644 KB
testcase_32 AC 28 ms
7,644 KB
testcase_33 AC 30 ms
7,644 KB
testcase_34 AC 30 ms
7,644 KB
testcase_35 AC 28 ms
7,644 KB
testcase_36 AC 29 ms
7,644 KB
testcase_37 AC 28 ms
7,644 KB
testcase_38 AC 29 ms
7,644 KB
testcase_39 AC 29 ms
7,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
#include<atcoder/segtree>
using namespace std;
int op(int a,int b){return min(a,b);}
int e(){return(int)1e9;}
int H,W;
string S[1<<17];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin>>H>>W;
	for(int i=0;i<H;i++)cin>>S[i];
	vector<int>prv(W,0);
	for(int i=H-2;i>=0;i--)
	{
		atcoder::segtree<int,op,e>seg(W);
		int l=0,r=0;
		while(r<W&&S[i][r]!='#')
		{
			seg.set(r,prv[r]);
			r++;
		}
		for(int j=0;j<W;j++)
		{
			if(S[i][j]=='#')
			{
				assert(l<=r&&r==j);
				r++;
				while(r<W&&S[i][r]!='#')
				{
					seg.set(r,prv[r]);
					r++;
				}
				while(l<=j)seg.set(l++,(int)1e9);
				prv[j]=1e9;
			}
			if(S[i][j]=='.')
			{
				int l=-1,r=W;
				while(r-l>1)
				{
					int mid=(l+r)/2;
					if(seg.prod(max(j-mid,0),min(j+mid+1,W))<=mid)r=mid;
					else l=mid;
				}
				prv[j]=r;
			}
		}
	}
	for(int j=0;j<W;j++)cout<<prv[j]<<"\n";
}
0