結果

問題 No.1465 Archaea
ユーザー rrta
提出日時 2021-04-05 02:17:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 1,815 ms
コンパイル使用メモリ 175,424 KB
実行使用メモリ 15,872 KB
最終ジャッジ日時 2024-12-29 13:56:03
合計ジャッジ時間 2,905 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
static const ll INF=1000000000000000;
using Graph=vector<vector<ll>>;
ll N,K;
ll d[200005];
void bfs(const Graph &G,ll s){
fill(d,d+N+1,INF);d[s]=0;
  queue<ll>que;que.push(s);
  while(!que.empty()){
  ll v=que.front();que.pop();
    for(auto u:G[v]){
    if(d[u]!=INF)continue;
      d[u]=d[v]+1;que.push(u);
    }
  }
}
int main(){
 cin>>N>>K;
  Graph G(N+1);if(2<=N)G[2].push_back(1);
  for(ll i=3;i<=N;i++){
  G[i].push_back(i-3);
    if(i%2==0)G[i].push_back(i/2);
  }bfs(G,N);
  if(d[1]<=K)cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}
0