結果

問題 No.611 Day of the Mountain
ユーザー tailstails
提出日時 2017-12-22 12:14:10
言語 cLay
(20231016-1)
結果
AC  
実行時間 1,311 ms / 2,017 ms
コード長 553 bytes
コンパイル時間 3,680 ms
コンパイル使用メモリ 179,420 KB
実行使用メモリ 4,736 KB
最終ジャッジ日時 2023-09-18 23:50:41
合計ジャッジ時間 9,422 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,057 ms
4,648 KB
testcase_01 AC 1,047 ms
4,392 KB
testcase_02 AC 1,007 ms
4,452 KB
testcase_03 AC 1,311 ms
4,388 KB
testcase_04 AC 3 ms
4,392 KB
testcase_05 AC 3 ms
4,408 KB
testcase_06 AC 3 ms
4,736 KB
testcase_07 AC 3 ms
4,544 KB
testcase_08 AC 4 ms
4,388 KB
testcase_09 AC 3 ms
4,384 KB
testcase_10 AC 3 ms
4,448 KB
testcase_11 AC 3 ms
4,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define MD 201712111

int h,w,t[320];
char a[320][320];
mint d[1<<18],*u=d,*v=d+(1<<17);

{
	rd(h,w,a(h));
	if(w>h){
		rep(y,w)rep(x,y)swap(a[y][x],a[x][y]);
		swap(w,h);
	}
	u[0]=1;
	rep(y,h)rep(x,w){
		int ty=(y?t[x]:1<<30);
		int tx=(x?t[x-1]:1<<30);
		rep(b,1<<w){
			bool b0=1&b>>x;
			bool b1=1&b>>x-1;
			v[b]=(ty<tx||ty>tx&&b0==b1||ty==tx&&b0<=b1)*(u[b]+(ty>tx||ty==tx&&!b1)*u[b^1<<x]);
			if(b0&&a[y][x]=='?'){
				v[b]+=(v[b-(1<<x)]+v[b])*8;
			}
		}
		swap(u,v);
		t[x]=(x+y?min(ty,tx):0)+a[y][x]%16%14;
	}
	wt(t[w-1]);
	wt(sum(u(1<<w-1)));
}
0