結果

問題 No.1577 織姫と彦星2
ユーザー tailstails
提出日時 2021-06-29 14:57:57
言語 cLay
(20240104-1)
結果
RE  
実行時間 -
コード長 681 bytes
コンパイル時間 2,350 ms
コンパイル使用メモリ 175,768 KB
実行使用メモリ 9,212 KB
最終ジャッジ日時 2023-09-19 02:32:11
合計ジャッジ時間 32,203 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 82 ms
4,384 KB
testcase_06 AC 10 ms
4,380 KB
testcase_07 AC 718 ms
7,616 KB
testcase_08 RE -
testcase_09 RE -
testcase_10 AC 142 ms
4,376 KB
testcase_11 AC 7 ms
4,380 KB
testcase_12 RE -
testcase_13 AC 98 ms
4,376 KB
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 2 ms
4,380 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 796 ms
4,488 KB
testcase_28 RE -
testcase_29 AC 250 ms
4,444 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 AC 423 ms
4,384 KB
testcase_43 AC 440 ms
4,528 KB
testcase_44 AC 3 ms
4,380 KB
testcase_45 RE -
testcase_46 AC 67 ms
4,380 KB
testcase_47 AC 934 ms
4,380 KB
testcase_48 AC 178 ms
4,376 KB
testcase_49 RE -
testcase_50 AC 103 ms
4,392 KB
testcase_51 AC 13 ms
4,380 KB
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 RE -
testcase_56 RE -
testcase_57 AC 25 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

{
	VI nodes[32];
	map<int,VI> edges;
	set<int> vis;

	ll@n,@st,@ed;
	nodes[__builtin_popcountl(st)].push_back(st);
	nodes[__builtin_popcountl(ed)].push_back(ed);
	rep(n){
		ll@s;
		nodes[__builtin_popcountl(s)].push_back(s);
	}
	rep(i,31){
		for(ll j:nodes[i]){
			for(ll k:nodes[i+1]){
				if(__builtin_popcount(j^k)==1){
					edges[j].push_back(k);
					edges[k].push_back(j);
				}
			}
		}
	}
	int q[3000];
	ll qr=0,qw=0,ans=0;
	q[qw++]=st;
	while(qr<qw){
		ll qn=qw;
		while(qr<qn){
			ll s=q[qr++];
			if(s==ed){
				wt(ans-1);
				exit(0);
			}
			for(ll j:edges[s]){
				if(vis.find(j)==vis.end()){
					vis.insert(j);
					q[qw++]=j;
				}
			}
		}
		++ans;
	}
	wt(-1);
}
0