結果

問題 No.1949 足し算するだけのパズルゲーム(2)
ユーザー tailstails
提出日時 2022-05-20 22:52:49
言語 cLay
(20231016-1)
結果
AC  
実行時間 62 ms / 3,000 ms
コード長 600 bytes
コンパイル時間 2,147 ms
コンパイル使用メモリ 181,476 KB
実行使用メモリ 9,988 KB
最終ジャッジ日時 2023-10-20 13:43:08
合計ジャッジ時間 3,731 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 28 ms
6,596 KB
testcase_08 AC 8 ms
6,632 KB
testcase_09 AC 8 ms
6,632 KB
testcase_10 AC 9 ms
6,636 KB
testcase_11 AC 8 ms
6,696 KB
testcase_12 AC 7 ms
6,724 KB
testcase_13 AC 32 ms
6,168 KB
testcase_14 AC 28 ms
9,988 KB
testcase_15 AC 29 ms
9,988 KB
testcase_16 AC 6 ms
6,320 KB
testcase_17 AC 62 ms
9,676 KB
testcase_18 AC 6 ms
6,320 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 41 ms
7,624 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 18 ms
6,136 KB
testcase_25 AC 8 ms
6,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

ll@h,@w,@y--,@x--,@a[h][w],b=a[y][x];
a[y][x]=0;
priority_queue<pair<ll,pair<ll,ll>>>q;
goto hoge;

while(!q.empty()){
	{
		auto t=q.top();
		q.pop();
		if(-t.first>=b){
			wt("No");
			exit(0);
		}
		b+=-t.first;
		if(b>1000000000){
			// muteki!
			wt("Yes");
			exit(0);
		}
		y=t.second.first;
		x=t.second.second;
	}
	hoge:;
	if(y    &&a[y-1][x]) q.push({-a[y-1][x],{y-1,x}}),a[y-1][x]=0;
	if(y<h-1&&a[y+1][x]) q.push({-a[y+1][x],{y+1,x}}),a[y+1][x]=0;
	if(x    &&a[y][x-1]) q.push({-a[y][x-1],{y,x-1}}),a[y][x-1]=0;
	if(x<w-1&&a[y][x+1]) q.push({-a[y][x+1],{y,x+1}}),a[y][x+1]=0;
}
wt("Yes");

0