結果
| 問題 |
No.1577 織姫と彦星2
|
| ユーザー |
tails
|
| 提出日時 | 2021-06-29 14:57:57 |
| 言語 | cLay (20241019-1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 681 bytes |
| コンパイル時間 | 2,219 ms |
| コンパイル使用メモリ | 186,488 KB |
| 実行使用メモリ | 8,832 KB |
| 最終ジャッジ日時 | 2024-07-05 15:21:04 |
| 合計ジャッジ時間 | 29,040 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 18 RE * 35 |
ソースコード
{
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);
}
tails