結果

問題 No.2731 Two Colors
ユーザー tailstails
提出日時 2024-04-19 22:16:32
言語 cLay
(20240104-1)
結果
AC  
実行時間 133 ms / 3,000 ms
コード長 456 bytes
コンパイル時間 3,989 ms
コンパイル使用メモリ 175,028 KB
実行使用メモリ 30,848 KB
最終ジャッジ日時 2024-04-19 22:16:59
合計ジャッジ時間 6,954 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
30,592 KB
testcase_01 AC 133 ms
30,848 KB
testcase_02 AC 128 ms
30,848 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 6 ms
5,376 KB
testcase_05 AC 4 ms
5,376 KB
testcase_06 AC 15 ms
8,448 KB
testcase_07 AC 13 ms
9,088 KB
testcase_08 AC 4 ms
5,376 KB
testcase_09 AC 43 ms
21,632 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 65 ms
17,280 KB
testcase_12 AC 41 ms
20,608 KB
testcase_13 AC 54 ms
15,232 KB
testcase_14 AC 21 ms
11,264 KB
testcase_15 AC 5 ms
5,376 KB
testcase_16 AC 26 ms
11,008 KB
testcase_17 AC 32 ms
13,952 KB
testcase_18 AC 8 ms
5,376 KB
testcase_19 AC 26 ms
9,856 KB
testcase_20 AC 25 ms
16,000 KB
testcase_21 AC 8 ms
5,376 KB
testcase_22 AC 54 ms
20,224 KB
testcase_23 AC 15 ms
8,064 KB
testcase_24 AC 8 ms
5,632 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 40 ms
18,048 KB
testcase_27 AC 50 ms
22,144 KB
testcase_28 AC 38 ms
15,104 KB
testcase_29 AC 16 ms
7,680 KB
testcase_30 AC 20 ms
10,752 KB
testcase_31 AC 15 ms
7,424 KB
testcase_32 AC 72 ms
25,728 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 1 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@h,@w,@a[h*w];
char c[]{};
DijkstraHeap<ll> q[2];
q[0..1].malloc(h*w,1);
q[0].change(0,0);
q[1].change(h*w-1,0);
ll k=0;
for(;;++k){
	ll p=k&1;
	ll i=q[p].pop();
	c[i]=p+1;
	ll y=i/w;
	ll x=i%w;
	if(y)    {ll d=i-w;if(c[d]==2-p)break; q[p].change(d,a[d]);}
	if(y<h-1){ll d=i+w;if(c[d]==2-p)break; q[p].change(d,a[d]);}
	if(x)    {ll d=i-1;if(c[d]==2-p)break; q[p].change(d,a[d]);}
	if(x<w-1){ll d=i+1;if(c[d]==2-p)break; q[p].change(d,a[d]);}
}
wt(k-1);
0