結果

問題 No.2657 Falling Block Game
ユーザー kotatsugamekotatsugame
提出日時 2024-03-01 21:40:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,314 bytes
コンパイル時間 1,002 ms
コンパイル使用メモリ 80,948 KB
実行使用メモリ 15,452 KB
最終ジャッジ日時 2024-03-01 21:40:30
合計ジャッジ時間 4,793 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
7,516 KB
testcase_01 AC 4 ms
7,516 KB
testcase_02 AC 4 ms
7,644 KB
testcase_03 AC 4 ms
7,516 KB
testcase_04 AC 16 ms
7,644 KB
testcase_05 AC 97 ms
15,452 KB
testcase_06 AC 88 ms
11,492 KB
testcase_07 AC 115 ms
15,452 KB
testcase_08 AC 56 ms
8,156 KB
testcase_09 AC 34 ms
7,644 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 38 ms
7,644 KB
testcase_31 AC 37 ms
7,644 KB
testcase_32 AC 37 ms
7,644 KB
testcase_33 AC 39 ms
7,644 KB
testcase_34 AC 37 ms
7,644 KB
testcase_35 AC 38 ms
7,644 KB
testcase_36 AC 39 ms
7,644 KB
testcase_37 AC 38 ms
7,644 KB
testcase_38 AC 38 ms
7,644 KB
testcase_39 AC 39 ms
7,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cassert>
using namespace std;
//Disjoint Sparse Table
#include<vector>
#include<functional>
template<typename T>
struct DST{
	int n;
	vector<vector<T> >dat;
	DST(const vector<T>&v={})
	{
		n=v.size();
		dat.push_back(v);
		for(int i=2;i<n;i<<=1)
		{
			dat.push_back(vector<T>(n));
			for(int j=i;j<n;j+=i<<1)
			{
				dat.back()[j-1]=dat[0][j-1];
				for(int k=2;k<=i;k++)
				{
					dat.back()[j-k]=min(dat[0][j-k],dat.back()[j-k+1]);
				}
				dat.back()[j]=dat[0][j];
				for(int k=2;k<=i&&j+k<=n;k++)
				{
					dat.back()[j+k-1]=min(dat.back()[j+k-2],dat[0][j+k-1]);
				}
			}
		}
	}
	T query(int l,int r)const//[l,r)
	{
		if(l<0)l=0;
		if(r>n)r=n;
		r--;
		if(l==r)return dat[0][l];
		int k=31-__builtin_clz(l^r);
		return min(dat[k][l],dat[k][r]);
	}
};
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--)
	{
		for(int j=0;j<W;j++)if(S[i][j]=='#')prv[j]=1e9;
		vector<int>now(W,(int)1e9);
		DST<int>dst(prv);
		for(int j=0;j<W;j++)if(S[i][j]=='.')
		{
			int l=-1,r=W;
			while(r-l>1)
			{
				int mid=(l+r)/2;
				if(dst.query(j-mid,j+mid+1)<=mid)r=mid;
				else l=mid;
			}
			now[j]=r;
		}
		prv=now;
	}
	for(int j=0;j<W;j++)cout<<prv[j]<<"\n";
}
0