結果

問題 No.1949 足し算するだけのパズルゲーム(2)
ユーザー tailstails
提出日時 2022-05-20 22:51:07
言語 cLay
(20240104-1)
結果
WA  
実行時間 -
コード長 600 bytes
コンパイル時間 4,714 ms
コンパイル使用メモリ 181,308 KB
実行使用メモリ 10,000 KB
最終ジャッジ日時 2023-10-20 13:41:36
合計ジャッジ時間 6,180 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

ll@h,@w,@x--,@y--,@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